Class ThreadPoolProvider.LazySharedProvider<T extends ExecutorService>

java.lang.Object
net.dv8tion.jda.api.sharding.ThreadPoolProvider.LazySharedProvider<T>
All Implemented Interfaces:
ThreadPoolProvider<T>
Enclosing interface:
ThreadPoolProvider<T extends ExecutorService>

public static final class ThreadPoolProvider.LazySharedProvider<T extends ExecutorService> extends Object implements ThreadPoolProvider<T>
  • Method Details

    • init

      public void init(int shardTotal)
      Called with the shard total to initialize the shared pool.

      This also destroys the temporary pool created for fetching the recommended shard total.

      Parameters:
      shardTotal - The shard total
    • shutdown

      public void shutdown()
      Shuts down the shared pool and the temporary pool.
    • provide

      @Nullable public T provide(int shardId)
      Provides the initialized pool or the temporary pool if not initialized yet.
      Specified by:
      provide in interface ThreadPoolProvider<T extends ExecutorService>
      Parameters:
      shardId - The current shard id
      Returns:
      The thread pool instance