@Deprecated public abstract class DefaultServicePool<Key,Service> extends ServiceSupport implements ServicePool<Key,Service>
Modifier and Type | Field and Description |
---|---|
protected int |
capacity
Deprecated.
|
protected org.slf4j.Logger |
log
Deprecated.
|
protected Map<Key,BlockingQueue<Service>> |
pool
Deprecated.
|
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
Modifier | Constructor and Description |
---|---|
protected |
DefaultServicePool()
Deprecated.
|
|
DefaultServicePool(int capacity)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
Service |
acquire(Key key)
Deprecated.
Tries to acquire the service with the given key
|
Service |
addAndAcquire(Key key,
Service service)
Deprecated.
Adds the given service to the pool and acquires it.
|
protected void |
doStart()
Deprecated.
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Deprecated.
Implementations override this method to support customized start/stop.
|
int |
getCapacity()
Deprecated.
Gets the capacity per key.
|
void |
purge()
Deprecated.
Purges the pool.
|
void |
release(Key key,
Service service)
Deprecated.
Releases the service back to the pool
|
void |
setCapacity(int capacity)
Deprecated.
Sets the capacity, which is capacity per key.
|
int |
size()
Deprecated.
Returns the current size of the pool
|
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
protected final org.slf4j.Logger log
protected final Map<Key,BlockingQueue<Service>> pool
protected int capacity
protected DefaultServicePool()
public DefaultServicePool(int capacity)
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 servicepublic Service acquire(Key key)
ServicePool
acquire
in interface ServicePool<Key,Service>
key
- the keypublic 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()
Apache Camel