|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.veriplace.client.util.AbstractRequestManager<ResultType>
public class AbstractRequestManager<ResultType>
Abstraction around making a Veriplace API request and retrieving the result.
Requests can block for some time, and the user interface should not be coupled too tightly with the request behavior. This implementation performs all requests on background threads. The caller can then block for the result at any time; typically the blocking wait will happen after we've displayed an automatically-refreshing "please wait" page.
| Nested Class Summary | |
|---|---|
static class |
AbstractRequestManager.AbstractRequest<ResultType>
Generic inner class for background requests. |
| Field Summary | |
|---|---|
protected RequestStore<ResultWrapper<ResultType>> |
requestStore
|
| Constructor Summary | |
|---|---|
AbstractRequestManager()
|
|
| Method Summary | |
|---|---|
ResultType |
getResult(long id)
Get (and remove) the result returned for the given request id, assuming that the request has completed. |
ResultWrapper<ResultType> |
getResultAndToken(long id)
Get (and remove) the result returned for the given request id, assuming that the request has completed. |
void |
setExecutorService(java.util.concurrent.ExecutorService executor)
|
void |
setRequestStore(RequestStore<ResultWrapper<ResultType>> requestStore)
|
long |
submitRequest(AbstractRequestManager.AbstractRequest<ResultType> request)
Submit a request object (which was created by some method of the specific AbstractRequestManager sucblass) for asynchronous processing. |
boolean |
waitForCompletion(long id)
Wait for the result of a request to be available. |
boolean |
waitForCompletion(long id,
long timeout)
Wait for the result of a request to be available. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected RequestStore<ResultWrapper<ResultType>> requestStore
| Constructor Detail |
|---|
public AbstractRequestManager()
| Method Detail |
|---|
public void setRequestStore(RequestStore<ResultWrapper<ResultType>> requestStore)
public void setExecutorService(java.util.concurrent.ExecutorService executor)
public long submitRequest(AbstractRequestManager.AbstractRequest<ResultType> request)
public boolean waitForCompletion(long id)
public boolean waitForCompletion(long id,
long timeout)
public ResultType getResult(long id)
throws VeriplaceException
VeriplaceException - if the request completed with an error result
public ResultWrapper<ResultType> getResultAndToken(long id)
throws VeriplaceException
VeriplaceException - if the request completed with an error result
BadParameterException - if the request ID does not exist or the
request has not completed
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||