public final class RrdSyncThreadPool extends Object
RrdNioBackend
instances to periodically sync the mapped file to disk. Note that instances
of RrdSyncThreadPool must be disposed of by calling shutdown()
.
For ease of use in standalone applications, clients may choose to register a shutdown hook by calling
registerShutdownHook()
. However, in web applications it is best to explicitly shutdown()
the pool
when the application is un-deployed, usually within a javax.servlet.ServletContextListener
.Constructor and Description |
---|
RrdSyncThreadPool()
Creates a new RrdSyncThreadPool with a default pool size of 6.
|
RrdSyncThreadPool(int syncPoolSize)
Creates a new RrdSyncThreadPool with the given pool size.
|
RrdSyncThreadPool(int syncPoolSize,
ThreadFactory threadFactory)
Creates a new RrdSyncThreadPool with the given pool size.
|
RrdSyncThreadPool(ScheduledExecutorService syncExecutor)
Creates a new RrdSyncThreadPool with a user-provided ScheduledExecutorService.
|
Modifier and Type | Method and Description |
---|---|
RrdSyncThreadPool |
registerShutdownHook()
Registers a shutdown hook that destroys the underlying thread pool when when the JVM is about to quit.
|
void |
shutdown()
Shuts down this thread pool in an orderly manner.
|
void |
unregisterShutdownHook()
Unregisters the shutdown hook installed by
registerShutdownHook() . |
public RrdSyncThreadPool()
public RrdSyncThreadPool(ScheduledExecutorService syncExecutor)
syncExecutor
- the ScheduledExecutorService to use for sync'ing mapped files to diskpublic RrdSyncThreadPool(int syncPoolSize)
syncPoolSize
- the number of threads to use to sync the mapped file to diskpublic RrdSyncThreadPool(int syncPoolSize, ThreadFactory threadFactory)
threadFactory
.syncPoolSize
- the number of threads to use to sync the mapped file to diskthreadFactory
- the ThreadFactory to use for creating threadspublic RrdSyncThreadPool registerShutdownHook()
unregisterShutdownHook()
public void unregisterShutdownHook()
registerShutdownHook()
. Has no effect if the hook is not
currently installed.unregisterShutdownHook()
public void shutdown()
Copyright © 2015. All rights reserved.