|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.camel.support.ServiceSupport
org.apache.camel.impl.DefaultServicePool<Key,Service>
public abstract class DefaultServicePool<Key,Service>
Default implementation to inherit for a basic service pool.
Field Summary | |
---|---|
protected int |
capacity
|
protected org.slf4j.Logger |
log
|
protected ConcurrentMap<Key,BlockingQueue<Service>> |
pool
|
Fields inherited from class org.apache.camel.support.ServiceSupport |
---|
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending |
Constructor Summary | |
---|---|
protected |
DefaultServicePool()
|
|
DefaultServicePool(int capacity)
|
Method Summary | |
---|---|
Service |
acquire(Key key)
Tries to acquire the service with the given key |
Service |
addAndAcquire(Key key,
Service service)
Adds the given service to the pool and acquires it. |
protected void |
doStart()
Implementations override this method to support customized start/stop. |
protected void |
doStop()
Implementations override this method to support customized start/stop. |
int |
getCapacity()
Gets the capacity per key. |
void |
purge()
Purges the pool. |
void |
release(Key key,
Service service)
Releases the service back to the pool |
void |
setCapacity(int capacity)
Sets the capacity, which is capacity per key. |
int |
size()
Returns the current size of the pool |
Methods inherited from class org.apache.camel.support.ServiceSupport |
---|
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, resume, shutdown, start, stop, suspend |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.slf4j.Logger log
protected final ConcurrentMap<Key,BlockingQueue<Service>> pool
protected int capacity
Constructor Detail |
---|
protected DefaultServicePool()
public DefaultServicePool(int capacity)
Method Detail |
---|
public int getCapacity()
ServicePool
getCapacity
in interface ServicePool<Key,Service>
public void setCapacity(int capacity)
ServicePool
setCapacity
in interface ServicePool<Key,Service>
capacity
- the capacity per keypublic int size()
ServicePool
size
in interface ServicePool<Key,Service>
public Service addAndAcquire(Key key, Service service)
ServicePool
addAndAcquire
in interface ServicePool<Key,Service>
key
- the keyservice
- the service
public Service acquire(Key key)
ServicePool
acquire
in interface ServicePool<Key,Service>
key
- the key
public void release(Key key, Service service)
ServicePool
release
in interface ServicePool<Key,Service>
key
- the keyservice
- the servicepublic void purge()
ServicePool
purge
in interface ServicePool<Key,Service>
protected void doStart() throws Exception
ServiceSupport
ServiceSupport.doStop()
for more details.
doStart
in class ServiceSupport
Exception
ServiceSupport.doStop()
protected void doStop() throws Exception
ServiceSupport
ServiceSupport.doStop()
method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext
is shutting down.
doStop
in class ServiceSupport
Exception
ServiceSupport.doStart()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |