Package net.dv8tion.jda.api.utils
Class SessionControllerAdapter
java.lang.Object
net.dv8tion.jda.api.utils.SessionControllerAdapter
- All Implemented Interfaces:
SessionController
- Direct Known Subclasses:
ConcurrentSessionController
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.utils.SessionController
SessionController.SessionConnectNode, SessionController.ShardedGateway
-
Field Summary
Fields inherited from interface net.dv8tion.jda.api.utils.SessionController
IDENTIFY_DELAY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Called by a JDA session when a WebSocket should be started.long
Provides the cross-session global REST ratelimit it received throughSessionController.setGlobalRatelimit(long)
.getShardedGateway
(JDA api) Called byDefaultShardManager
when a new shards is starting.void
Called by a JDA session when a shutdown has been requested.void
setGlobalRatelimit
(long ratelimit) Called by the RateLimiter if the global rest ratelimit has changed.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.dv8tion.jda.api.utils.SessionController
getGateway, setConcurrency
-
Constructor Details
-
SessionControllerAdapter
public SessionControllerAdapter()
-
-
Method Details
-
appendSession
Description copied from interface:SessionController
Called by a JDA session when a WebSocket should be started. (Connecting and Reconnecting)
This should only add the node to a queue and execute the queue with respect to theSessionController.IDENTIFY_DELAY
.- Specified by:
appendSession
in interfaceSessionController
- Parameters:
node
- TheSessionConnectNode
-
removeSession
Description copied from interface:SessionController
Called by a JDA session when a shutdown has been requested.
When this happened theSessionConnectNode.run(boolean)
will be a no-op and does not contribute to theSessionController.IDENTIFY_DELAY
.- Specified by:
removeSession
in interfaceSessionController
- Parameters:
node
- TheSessionConnectNode
to remove from the queue.
-
getGlobalRatelimit
public long getGlobalRatelimit()Description copied from interface:SessionController
Provides the cross-session global REST ratelimit it received throughSessionController.setGlobalRatelimit(long)
.- Specified by:
getGlobalRatelimit
in interfaceSessionController
- Returns:
- The current global REST ratelimit or -1 if unset
-
setGlobalRatelimit
public void setGlobalRatelimit(long ratelimit) Description copied from interface:SessionController
Called by the RateLimiter if the global rest ratelimit has changed.- Specified by:
setGlobalRatelimit
in interfaceSessionController
- Parameters:
ratelimit
- The new global ratelimit
-
getShardedGateway
Description copied from interface:SessionController
Called byDefaultShardManager
when a new shards is starting.
Should provide aSessionController.ShardedGateway
with(gateway, shardTotal)
.- Specified by:
getShardedGateway
in interfaceSessionController
- Parameters:
api
- The current JDA instance (used for RestActions and ShardInfo)- Returns:
- The ShardedGateway instance consisting of the gateway endpoint to connect to and the shardTotal
- See Also:
-