|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsk.baka.webvm.misc.BackgroundService
public abstract class BackgroundService
Executes various tasks in background thread.
| Field Summary | |
|---|---|
protected int |
maxThreads
Maximum thread pool size. |
protected String |
name
A short name of the service - used in thread names. |
| Constructor Summary | |
|---|---|
protected |
BackgroundService(String name,
int maxThreads)
Creates new service instance. |
| Method Summary | |
|---|---|
protected ScheduledExecutorService |
getExecutor()
Returns the executor. |
static ThreadFactory |
newDaemonFactory(String name)
Creates a new factory which creates daemon threads using the Executors.defaultThreadFactory(). |
void |
start()
Starts the sampling process in a background thread. |
protected abstract void |
started(ScheduledExecutorService executor)
Invoked when the service is started. |
void |
stop()
Disposes of this sampler. |
protected abstract void |
stopped()
Invoked after the service has been stopped. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final String name
protected final int maxThreads
| Constructor Detail |
|---|
protected BackgroundService(String name,
int maxThreads)
name - A short name of the service - used in thread names.maxThreads - Maximum thread pool size.| Method Detail |
|---|
public void start()
protected abstract void started(ScheduledExecutorService executor)
executor - executes tasks.protected final ScheduledExecutorService getExecutor()
public final void stop()
protected abstract void stopped()
public static ThreadFactory newDaemonFactory(String name)
Executors.defaultThreadFactory().
name - create threads marked with this name.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||