public class ExecutorQueueService extends AbstractQueueService implements LifecycleQueueService, org.osgi.service.cm.ManagedService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
EXECUTOR_QUEUE_SERVICE_PID
Service PID used to identify service with ConfigAdmin.
|
static java.lang.String |
THREADPOOL_SIZE_PROPERTY
Property name used to configure this ThreadPool's size (usable as System Property or ConfigAdmin property).
|
m_listeners
m_bundleContext
ASYNCHRONOUS_QUEUE_MODE, GLOABL_QUEUE_SCOPE, PREFERENCE_QUEUE_MODE, QUEUE_MODE_PROPERTY, QUEUE_SCOPE_PROPERTY, SYNCHRONOUS_QUEUE_MODE
Constructor and Description |
---|
ExecutorQueueService(org.osgi.framework.BundleContext bundleContext)
Creates the queue service using the default pool size.
|
ExecutorQueueService(org.osgi.framework.BundleContext bundleContext,
int size)
Creates the queue service.
|
ExecutorQueueService(org.osgi.framework.BundleContext bundleContext,
int size,
java.util.concurrent.ThreadFactory threadFactory)
Creates the queue service.
|
Modifier and Type | Method and Description |
---|---|
int |
getCurrents() |
int |
getFinished() |
protected java.util.Dictionary<java.lang.String,?> |
getServiceProperties() |
int |
getWaiters() |
java.util.List<JobInfo> |
getWaitersInfo() |
protected org.osgi.framework.ServiceRegistration<?> |
registerService() |
void |
stop()
Stops the service.
|
<T> java.util.concurrent.Future<T> |
submit(Job<T> callable)
Submits a job to the queue service.
|
<T> java.util.concurrent.Future<T> |
submit(Job<T> callable,
Callback<T> callback,
java.lang.String description)
Submits a job to the queue.
|
<T> java.util.concurrent.Future<T> |
submit(Job<T> callable,
java.lang.String description)
Submits a job to the queue service.
|
void |
updated(java.util.Dictionary properties) |
addQueueListener, fireEnlistedJobInfo, fireExecutedJobInfo, fireFailedJobInfo, fireStartedJobInfo, removeQueueListener
getBundleContext, getRegistration, isRegistered, start
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addQueueListener, removeQueueListener
public static final java.lang.String THREADPOOL_SIZE_PROPERTY
public static final java.lang.String EXECUTOR_QUEUE_SERVICE_PID
public ExecutorQueueService(org.osgi.framework.BundleContext bundleContext)
bundleContext
- the bundle context.public ExecutorQueueService(org.osgi.framework.BundleContext bundleContext, int size)
bundleContext
- the bundle context.size
- the thread pool size.public ExecutorQueueService(org.osgi.framework.BundleContext bundleContext, int size, java.util.concurrent.ThreadFactory threadFactory)
bundleContext
- the bundle context.size
- the thread pool sizethreadFactory
- the thread factoryprotected org.osgi.framework.ServiceRegistration<?> registerService()
registerService
in class AbstractService
public void stop()
stop
in interface Lifecycle
stop
in class AbstractService
protected java.util.Dictionary<java.lang.String,?> getServiceProperties()
getServiceProperties
in class AbstractService
public int getFinished()
getFinished
in interface QueueService
public int getWaiters()
getWaiters
in interface QueueService
public int getCurrents()
getCurrents
in interface QueueService
public java.util.List<JobInfo> getWaitersInfo()
getWaitersInfo
in interface QueueService
public <T> java.util.concurrent.Future<T> submit(Job<T> callable, Callback<T> callback, java.lang.String description)
JobInfoCallable
to collect the
statistics.submit
in interface QueueService
callable
- the jobcallback
- callback called when the job is processeddescription
- a description of the jobpublic <T> java.util.concurrent.Future<T> submit(Job<T> callable, java.lang.String description)
QueueService
submit
in interface QueueService
callable
- the jobdescription
- a description of the jobpublic <T> java.util.concurrent.Future<T> submit(Job<T> callable)
QueueService
submit
in interface QueueService
callable
- the jobpublic void updated(java.util.Dictionary properties) throws org.osgi.service.cm.ConfigurationException
updated
in interface org.osgi.service.cm.ManagedService
org.osgi.service.cm.ConfigurationException
Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved.