22
22
import net .dv8tion .jda .core .AccountType ;
23
23
import net .dv8tion .jda .core .JDA ;
24
24
import net .dv8tion .jda .core .OnlineStatus ;
25
- import net .dv8tion .jda .core .ShardedRateLimiter ;
26
25
import net .dv8tion .jda .core .audio .factory .IAudioSendFactory ;
27
26
import net .dv8tion .jda .core .entities .Game ;
28
27
import net .dv8tion .jda .core .entities .impl .JDAImpl ;
29
28
import net .dv8tion .jda .core .hooks .IEventManager ;
30
29
import net .dv8tion .jda .core .managers .impl .PresenceImpl ;
31
- import net .dv8tion .jda .core .requests .SessionReconnectQueue ;
32
- import net .dv8tion .jda .core .requests .WebSocketClient ;
33
- import net .dv8tion .jda .core .utils .*;
30
+ import net .dv8tion .jda .core .utils .Checks ;
31
+ import net .dv8tion .jda .core .utils .JDALogger ;
32
+ import net .dv8tion .jda .core .utils .SessionController ;
33
+ import net .dv8tion .jda .core .utils .SessionControllerAdapter ;
34
34
import net .dv8tion .jda .core .utils .tuple .Pair ;
35
35
import okhttp3 .OkHttpClient ;
36
36
import org .slf4j .Logger ;
39
39
import java .util .*;
40
40
import java .util .concurrent .*;
41
41
import java .util .concurrent .atomic .AtomicBoolean ;
42
- import java .util .function .Consumer ;
43
42
import java .util .function .IntFunction ;
44
43
45
44
/**
@@ -229,8 +228,6 @@ public class DefaultShardManager implements ShardManager
229
228
* The {@link com.neovisionaries.ws.client.WebSocketFactory WebSocketFactory}
230
229
* @param threadFactory
231
230
* The {@link java.util.concurrent.ThreadFactory ThreadFactory}
232
- * @param shardedRateLimiter
233
- * The {@link net.dv8tion.jda.core.ShardedRateLimiter ShardedRateLimiter}
234
231
* @param maxReconnectDelay
235
232
* The max reconnect delay
236
233
* @param corePoolSize
@@ -260,7 +257,7 @@ protected DefaultShardManager(final int shardsTotal, final Collection<Integer> s
260
257
final String token , final IEventManager eventManager , final IAudioSendFactory audioSendFactory ,
261
258
final IntFunction <Game > gameProvider , final IntFunction <OnlineStatus > statusProvider ,
262
259
final OkHttpClient .Builder httpClientBuilder , final WebSocketFactory wsFactory ,
263
- final ThreadFactory threadFactory , final ShardedRateLimiter shardedRateLimiter ,
260
+ final ThreadFactory threadFactory ,
264
261
final int maxReconnectDelay , final int corePoolSize , final boolean enableVoice ,
265
262
final boolean enableShutdownHook , final boolean enableBulkDeleteSplitting ,
266
263
final boolean autoReconnect , final IntFunction <Boolean > idleProvider ,
@@ -277,10 +274,7 @@ protected DefaultShardManager(final int shardsTotal, final Collection<Integer> s
277
274
this .httpClientBuilder = httpClientBuilder == null ? new OkHttpClient .Builder () : httpClientBuilder ;
278
275
this .wsFactory = wsFactory == null ? new WebSocketFactory () : wsFactory ;
279
276
this .executor = createExecutor (threadFactory );
280
- if (shardedRateLimiter != null && controller == null )
281
- this .controller = new ProvidingSessionController (null , shardedRateLimiter );
282
- else
283
- this .controller = controller == null ? new SessionControllerAdapter () : controller ;
277
+ this .controller = controller == null ? new SessionControllerAdapter () : controller ;
284
278
this .maxReconnectDelay = maxReconnectDelay ;
285
279
this .corePoolSize = corePoolSize ;
286
280
this .enableVoice = enableVoice ;
@@ -653,54 +647,4 @@ protected ScheduledExecutorService createExecutor(ThreadFactory threadFactory)
653
647
654
648
return Executors .newSingleThreadScheduledExecutor (factory );
655
649
}
656
-
657
- /**
658
- * This method creates the internal {@link net.dv8tion.jda.core.requests.SessionReconnectQueue SessionReconnectQueue}.
659
- * It is intended as a hook for custom implementations to create their own queue.
660
- *
661
- * <p><b>NOTE: The default implementation will add reconnects to the same queue as connects so they don't interfere with each other
662
- * (they share the same rate limit). If you override this you need to take care of it yourself.</b>
663
- *
664
- * @return A new ScheduledExecutorService
665
- *
666
- * @deprecated
667
- * Use {@link net.dv8tion.jda.core.utils.SessionController SessionController} directly instead
668
- */
669
- @ Deprecated
670
- protected SessionReconnectQueue createReconnectQueue ()
671
- {
672
- return new ForwardingSessionReconnectQueue (
673
- jda -> queue .add (jda .getShardInfo ().getShardId ()),
674
- jda -> queue .remove (jda .getShardInfo ().getShardId ()));
675
- }
676
-
677
- @ Deprecated
678
- public class ForwardingSessionReconnectQueue extends SessionReconnectQueue
679
- {
680
- private final Consumer <JDA > appender ;
681
- private final Consumer <JDA > remover ;
682
-
683
- public ForwardingSessionReconnectQueue (Consumer <JDA > appender , Consumer <JDA > remover )
684
- {
685
- super (null );
686
-
687
- this .appender = appender == null ? jda -> {} : appender ;
688
- this .remover = remover == null ? jda -> {} : remover ;
689
- }
690
-
691
- @ Override
692
- public void appendSession (final WebSocketClient client )
693
- {
694
- this .appender .accept (client .getJDA ());
695
- }
696
-
697
- @ Override
698
- public void removeSession (final WebSocketClient client )
699
- {
700
- this .remover .accept (client .getJDA ());
701
- }
702
-
703
- @ Override
704
- protected void runWorker () { /* just to overwrite */ }
705
- }
706
650
}
0 commit comments