com.veriplace.client.util
Interface RequestStore<ResultType>

All Known Implementing Classes:
MemoryRequestStore

public interface RequestStore<ResultType>

Generic interface for tracking background requests and storing their results.

The store object is responsible for cleaning up its own state over time.


Method Summary
 long add()
          Allocate a unique identifier for a subsequent response.
 ResultType get(long id)
          Get the result of a request.
 void put(long id, ResultType result)
          Save the result of a completed request.
 boolean waitForCompletion(long id)
          Wait for the result to be available for a previously submitted request.
 boolean waitForCompletion(long id, long timeout)
          Wait for the result to be available for a previously submitted request, but wait no more the timeout milliseconds.
 

Method Detail

add

long add()
Allocate a unique identifier for a subsequent response.


waitForCompletion

boolean waitForCompletion(long id)
Wait for the result to be available for a previously submitted request.

Returns:
true

waitForCompletion

boolean waitForCompletion(long id,
                          long timeout)
Wait for the result to be available for a previously submitted request, but wait no more the timeout milliseconds.

Returns:
if the result was available or a timeout occurred

put

void put(long id,
         ResultType result)
Save the result of a completed request.


get

ResultType get(long id)
Get the result of a request.