org.apache.camel.spi
Interface ServicePool<Key,Service>

All Superinterfaces:
Service
All Known Implementing Classes:
DefaultProducerServicePool, DefaultServicePool

public interface ServicePool<Key,Service>
extends Service

A service pool is like a connection pool but can pool any kind of objects.

Services that is capable of being pooled should implement the marker interface ServicePoolAware.

Version:
$Revision: 779038 $

Method Summary
 Service acquire(Key key)
          Tries to acquire the servie with the given key
 Service addAndAcquire(Key key, Service service)
          Adds the given service to the pool and acquires it.
 void release(Key key, Service service)
          Releases the service back to the pool
 
Methods inherited from interface org.apache.camel.Service
start, stop
 

Method Detail

addAndAcquire

Service addAndAcquire(Key key,
                      Service service)
Adds the given service to the pool and acquires it.

Parameters:
key - the key
service - the service
Returns:
the acquired service, is newer null

acquire

Service acquire(Key key)
Tries to acquire the servie with the given key

Parameters:
key - the key
Returns:
the acquired service, or null if no free in pool

release

void release(Key key,
             Service service)
Releases the service back to the pool

Parameters:
key - the key
service - the service


Apache CAMEL