Package discord4j.core.shard
Class DefaultShardingStrategy
java.lang.Object
discord4j.core.shard.DefaultShardingStrategy
- All Implemented Interfaces:
ShardingStrategy
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
Value representing the use of a recommended amount of shards. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondiscord4j.core.shard.GatewayClientGroupManager
getGroupManager
(int count) Return theGatewayClientGroupManager
to maintain each gateway client in the created group.int
Return the number of shards that can be identified concurrently.getShardCount
(RestClient restClient) Return the shard count used to create a group of sharded clients.getShards
(int shardCount) Return the shard factory used to create a group of sharded clients.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface discord4j.core.shard.ShardingStrategy
getMaxConcurrency
-
Field Details
-
RECOMMENDED_SHARD_COUNT
public static int RECOMMENDED_SHARD_COUNTValue representing the use of a recommended amount of shards.
-
-
Constructor Details
-
DefaultShardingStrategy
-
-
Method Details
-
getShardCount
Description copied from interface:ShardingStrategy
Return the shard count used to create a group of sharded clients.- Specified by:
getShardCount
in interfaceShardingStrategy
- Parameters:
restClient
- a handle to consume REST API resources, typically to retrieve the number of recommended shards- Returns:
- a shard count as a
Mono
to obtain this number asynchronously.
-
getShards
Description copied from interface:ShardingStrategy
Return the shard factory used to create a group of sharded clients.- Specified by:
getShards
in interfaceShardingStrategy
- Parameters:
shardCount
- the total number of shards- Returns:
- a shard factory as a sequence of
ShardInfo
items.
-
getGroupManager
public discord4j.core.shard.GatewayClientGroupManager getGroupManager(int count) Description copied from interface:ShardingStrategy
Return theGatewayClientGroupManager
to maintain each gateway client in the created group.- Specified by:
getGroupManager
in interfaceShardingStrategy
- Parameters:
count
- the total number of shards- Returns:
- a
GatewayClientGroupManager
used by this strategy
-
getMaxConcurrency
public int getMaxConcurrency()Description copied from interface:ShardingStrategy
Return the number of shards that can be identified concurrently. Must be 1 unless your application is authorized to use the large bot sharding system.- Specified by:
getMaxConcurrency
in interfaceShardingStrategy
- Returns:
- a value determining the sharding factor this strategy has
- See Also:
-