org.ow2.util.pool.impl.enhanced.api.recorder
Interface IPoolItemRecorder<E,I>

Type Parameters:
E - pool item type
I - identifier type

public interface IPoolItemRecorder<E,I>

Methods of this interface have to be thread safe.

Author:
Gael Lalire

Method Summary
 E fetch(I identifier)
          The identifier has to still be valid after the fetch, so if fetch is aborted we can call again the method in future.
 I record(E poolItem, I latestIdentifier)
          This method must not modify poolItem while recording, so if the record is aborted the poolItem can be returned without an useless fetch.
 void remove(I identifier)
          The identifier will not be use in future because the item has been removed from pool or the pool is finalized for example.
 

Method Detail

record

I record(E poolItem,
         I latestIdentifier)
This method must not modify poolItem while recording, so if the record is aborted the poolItem can be returned without an useless fetch. The latestIdentifier will not be use in future so if you are not reusing it (return the same identifier) you should remove data keeped by latestIdentifier.

Parameters:
poolItem - a pool item to record
latestIdentifier - the latest identifier fetch (below) method returns
Returns:
an identifier which will be used to fetch this item

fetch

E fetch(I identifier)
The identifier has to still be valid after the fetch, so if fetch is aborted we can call again the method in future.

Parameters:
identifier - this information contains information to fetch the item
Returns:
a fetched item

remove

void remove(I identifier)
The identifier will not be use in future because the item has been removed from pool or the pool is finalized for example.

Parameters:
identifier - an identifier


Copyright © 2007-2009 OW2 Consortium. All Rights Reserved.