# Class SchedulerServiceProviderHolder

java.lang.Object
org.mariadb.jdbc.internal.util.scheduler.SchedulerServiceProviderHolder

public class SchedulerServiceProviderHolder extends Object
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 Classes
Modifier and Type
Class
Description
`static interface`
`SchedulerServiceProviderHolder.SchedulerProvider`
Provider for thread pools which allow scheduling capabilities.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final SchedulerServiceProviderHolder.SchedulerProvider`
`DEFAULT_PROVIDER`
The default provider will construct a new pool on every request.

## Constructor Summary

Constructors
Constructor
Description
`SchedulerServiceProviderHolder()`

## Method Summary

Modifier and Type
Method
Description
`static void`
`close()`
Close currentProvider.
`static ThreadPoolExecutor`
`getBulkScheduler()`
`static ScheduledExecutorService`
`getFixedSizeScheduler(int initialThreadCount, String poolName)`
Get a fixed sized scheduler directly with the current set provider.
`static DynamicSizedSchedulerInterface`
`getScheduler(int initialThreadCount, String poolName, int maximumPoolSize)`
Get a Dynamic sized scheduler directly with the current set provider.
`static SchedulerServiceProviderHolder.SchedulerProvider`
`getSchedulerProvider()`
Get the currently set `SchedulerServiceProviderHolder.SchedulerProvider` from set invocations via `setSchedulerProvider(SchedulerProvider)`.
`static ScheduledExecutorService`
`getTimeoutScheduler()`
Get a scheduler to handle timeout.
`static void`
`setSchedulerProvider(SchedulerServiceProviderHolder.SchedulerProvider newProvider)`
Change the current set scheduler provider.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DEFAULT_PROVIDER

public static final SchedulerServiceProviderHolder.SchedulerProvider DEFAULT_PROVIDER
The default provider will construct a new pool on every request.

## Constructor Details

### SchedulerServiceProviderHolder

public SchedulerServiceProviderHolder()

## Method Details

### getSchedulerProvider

public static SchedulerServiceProviderHolder.SchedulerProvider getSchedulerProvider()
Get the currently set `SchedulerServiceProviderHolder.SchedulerProvider` from set invocations via `setSchedulerProvider(SchedulerProvider)`. If none has been set a default provider will be provided (never a `null` result).

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 to `getSchedulerProvider()`.

Parameters:
  `newProvider` - New provider to use, or `null` to use the default provider

### close

public static void close()
Close currentProvider.

### 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 to
  `poolName` - name of pool to identify threads
  `maximumPoolSize` - 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 to
  `poolName` - name of pool to identify threads
Returns:
  Scheduler capable of providing the needed thread count

### getTimeoutScheduler

public static ScheduledExecutorService getTimeoutScheduler()
Get a scheduler to handle timeout.

Returns:
  Scheduler capable of providing the needed thread count

### getBulkScheduler

public static ThreadPoolExecutor getBulkScheduler()