File tree Expand file tree Collapse file tree
src/main/java/cn/ussshenzhou/madparticle Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99import org .jetbrains .annotations .NotNull ;
1010import org .jspecify .annotations .NonNull ;
1111
12+ import java .lang .ref .Cleaner ;
1213import java .lang .reflect .Array ;
1314import java .util .*;
1415import java .util .concurrent .*;
2526 */
2627public class MultiThreadedEqualObjectLinkedOpenHashSetQueue <E > implements Queue <E > {
2728 private static final AtomicInteger ID = new AtomicInteger ();
29+ private static final Cleaner CLEANER = Cleaner .create ();
30+
2831 private final ObjectLinkedOpenHashSet <E >[] sets ;
2932 private final int maxSize ;
3033 private final DefaultEventExecutorGroup threadPool ;
@@ -42,6 +45,10 @@ public MultiThreadedEqualObjectLinkedOpenHashSetQueue(int initialCapacityOfEachT
4245 .setNameFormat ("MadParticle-MultiThreadedEqualObjectLinkedOpenHashSetQueue-" + ID .get () + "-Thread-%d" )
4346 .build ()
4447 );
48+
49+ //noinspection UnnecessaryLocalVariable
50+ var pool = this .threadPool ;
51+ CLEANER .register (this , pool ::shutdownGracefully );
4552 }
4653
4754 public MultiThreadedEqualObjectLinkedOpenHashSetQueue (int maxSize ) {
You can’t perform that action at this time.
0 commit comments