Package com.mewna.catnip.shard.manager
Interface ShardManager
- All Known Implementing Classes:
AbstractShardManager
,DefaultShardManager
public interface ShardManager
Manages the lifecycle of shards - starting, stopping, resuming, etc.
- Since:
- 8/15/18.
- Author:
- amy
-
Method Summary
Modifier and TypeMethodDescriptionaddCondition
(ShardCondition condition) Add a condition to this shard manager.void
addToConnectQueue
(int shard) Adds the given shard id to the connect queue.catnip()
shard
(int shard) Fetches a shard.int
shardIds()
void
shutdown()
Shuts down all shards.void
start()
Starts booting shards.
-
Method Details
-
shardCount
@Nonnegative int shardCount()- Returns:
- The number of shards this shard manager owns.
-
shardIds
Collection<Integer> shardIds()- Returns:
- The collection of shard ids owned by this shard manager instance.
-
start
void start()Starts booting shards. -
conditions
List<ShardCondition> conditions()- Returns:
- The shard conditions for this shard manager instance.
- See Also:
-
addCondition
Add a condition to this shard manager.- Parameters:
condition
- The new condition.- Returns:
- Itself.
-
addToConnectQueue
void addToConnectQueue(@Nonnegative int shard) Adds the given shard id to the connect queue.- Parameters:
shard
- The shard id to add.
-
shard
Fetches a shard.- Parameters:
shard
- The id of the shard to fetch.- Returns:
- The shard, if it exists, otherwise it throws a
NullPointerException
.
-
catnip
- Returns:
- The catnip instance this shard manager is for.
-
catnip
-
shutdown
void shutdown()Shuts down all shards.
-