|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.camel.impl.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.apache.commons.logging.Log |
log
|
protected ConcurrentHashMap<Key,BlockingQueue<Service>> |
pool
|
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()
|
protected void |
doStop()
|
int |
getCapacity()
Gets the capacity per key. |
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.impl.ServiceSupport |
---|
addChildService, doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, removeChildService, resume, shutdown, start, 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.apache.commons.logging.Log log
protected final ConcurrentHashMap<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 serviceprotected void doStart() throws Exception
doStart
in class ServiceSupport
Exception
protected void doStop() throws Exception
doStop
in class ServiceSupport
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |