Class SchedulerServiceProviderHolder
java.lang.Object
org.mariadb.jdbc.internal.util.scheduler.SchedulerServiceProviderHolder
Provider for when ever an internal thread pool is needed. This can allow library users to
override our default pooling behavior with possibly better and faster options.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceProvider for thread pools which allow scheduling capabilities. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static SchedulerServiceProviderHolder.SchedulerProviderstatic final SchedulerServiceProviderHolder.SchedulerProviderThe default provider will construct a new pool on every request. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ThreadPoolExecutorstatic ScheduledExecutorServicegetFixedSizeScheduler(int initialThreadCount, String poolName) Get a fixed sized scheduler directly with the current set provider.getScheduler(int initialThreadCount, String poolName, int maximumPoolSize) Get a Dynamic sized scheduler directly with the current set provider.Get the currently setSchedulerServiceProviderHolder.SchedulerProviderfrom set invocations viasetSchedulerProvider(SchedulerProvider).static ScheduledExecutorServiceGet a scheduler to handle timeout.static voidChange the current set scheduler provider.
-
Field Details
-
DEFAULT_PROVIDER
The default provider will construct a new pool on every request. -
currentProvider
-
-
Constructor Details
-
SchedulerServiceProviderHolder
public SchedulerServiceProviderHolder()
-
-
Method Details
-
getSchedulerProvider
Get the currently setSchedulerServiceProviderHolder.SchedulerProviderfrom set invocations viasetSchedulerProvider(SchedulerProvider). If none has been set a default provider will be provided (never anullresult).- Returns:
- Provider to get scheduler pools from
-
setSchedulerProvider
public static void setSchedulerProvider(SchedulerServiceProviderHolder.SchedulerProvider newProvider) Change the current set scheduler provider. This provider will be provided in future requests togetSchedulerProvider().- Parameters:
newProvider- New provider to use, ornullto use the default provider
-
getScheduler
public static DynamicSizedSchedulerInterface getScheduler(int initialThreadCount, String poolName, int maximumPoolSize) Get a Dynamic sized scheduler directly with the current set provider.- Parameters:
initialThreadCount- Number of threads scheduler is allowed to grow topoolName- name of pool to identify threadsmaximumPoolSize- maximum pool size- Returns:
- Scheduler capable of providing the needed thread count
-
getFixedSizeScheduler
public static ScheduledExecutorService getFixedSizeScheduler(int initialThreadCount, String poolName) Get a fixed sized scheduler directly with the current set provider.- Parameters:
initialThreadCount- Number of threads scheduler is allowed to grow topoolName- name of pool to identify threads- Returns:
- Scheduler capable of providing the needed thread count
-
getTimeoutScheduler
Get a scheduler to handle timeout.- Returns:
- Scheduler capable of providing the needed thread count
-
getBulkScheduler
-