com.tivoli.pd.jutil
Interface PooledContextBuilder<C extends PDContext>

All Known Implementing Classes:
DefaultPooledPDContextBuilder

public interface PooledContextBuilder<C extends PDContext>

A PDContext builder interface to be used in conjunction with ContextPool to create the shared PDContexts for the pool.

See Also:
ContextPool

Method Summary
 C build()
          Create a new shared context.
 C onCheckoutContext(ContextPool<C> pool, C context)
          This method is called before the ContextPool returns a shared PDContext to the pool caller.
 

Method Detail

build

C build()
                          throws PDException
Create a new shared context. This method will be called by the ContextPool to create a new PDContext to be shared in the pool.

Returns:
a PDContext to be managed by the pool.
Throws:
PDException - when an error has occurred.

onCheckoutContext

C onCheckoutContext(ContextPool<C> pool,
                    C context)
                                      throws PDException
This method is called before the ContextPool returns a shared PDContext to the pool caller. Implementor has the option of preparing the shared context (e.g. wrapping the shared context, resetting the state etc) before ContextPool.getContext() returns a context to the to the client code.

Parameters:
context - the shared context checked out.
Returns:
a context to the ContextPool.getContext() caller.
Throws:
PDException - when an error has occurred.