public interface ServicePool<Key,Service>
ServicePoolAware
.
Notice the capacity is per key which means that each key can contain at most
(the capacity) services. The pool can contain an unbounded number of keys.
By default the capacity is set to 100.Modifier and Type | Method and Description |
---|---|
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.
|
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
|
void setCapacity(int capacity)
capacity
- the capacity per keyint getCapacity()
Service addAndAcquire(Key key, Service service)
key
- the keyservice
- the serviceIllegalStateException
- if the queue is full (capacity has been reached)Service acquire(Key key)
key
- the keyvoid release(Key key, Service service)
key
- the keyservice
- the serviceint size()
void purge()
Apache Camel