org.zkoss.zk.ui.sys
Interface RequestQueue

All Known Implementing Classes:
RequestQueueImpl

public interface RequestQueue

A queue of AuRequest. There is one queue for each desktop.

Implementation Note: Unlike only of desktop members, this class must be thread-safe.

Author:
tomyeh

Method Summary
 void addRequestId(java.lang.String requestId)
          Adds a request ID that uniquely identifies a request.
 boolean addRequests(java.util.Collection requests)
          Adds a list of requests.
 java.util.Collection clearRequestIds()
          Clears all request IDs that were added by addRequestId(java.lang.String).
 boolean endWithRequest()
          Called when ending the processing of the request queue.
 AuRequest nextRequest()
          Returns the next request, or null if no more request.
 void setInProcess()
          Marks the queue to denote it is being processing.
 

Method Detail

endWithRequest

boolean endWithRequest()
Called when ending the processing of the request queue.

Note: the in-process flag is cleared after the invocation. In other words, this method is designed to be called when an execution is about to de-activate.

Typical use:
Call this method after timeout (there might be pending requests). If it returns true, the caller sends a response to ask client to send anther request.

Returns:
whether any request is available in the queue.

nextRequest

AuRequest nextRequest()
Returns the next request, or null if no more request. Onced returned, the request is removed from the queue.

Note: if no more request, this queue is automatically marked a flag to denote no one is processing the queue.

The call shall invoke this method until null is returned, or timeout. If timeout, it shall invoke endWithRequest() in a way described in endWithRequest().


setInProcess

void setInProcess()
Marks the queue to denote it is being processing. Then, addRequests(java.util.Collection) will return true to tell the caller is free to leave without process the pendinig requests.


addRequests

boolean addRequests(java.util.Collection requests)
Adds a list of requests. Usually called by execs, that are not activated yeh, to pass request to the activated one.

Note: caller might check the returned value. If false is returned, it means the no one is processing queue, and the caller is responsible to process all pending requests. Before processing, it shall call setInProcess() to notify following executions free to leave. On the other hand, if true is returned, it means the queue is being processed by some one else, and the caller is free to leave.

Returns:
whether the queue is being processed by another execution.

addRequestId

void addRequestId(java.lang.String requestId)
Adds a request ID that uniquely identifies a request. It is used to notify PerformanceMeter.

Parameters:
requestId - the request ID (never null)
Since:
3.0.0

clearRequestIds

java.util.Collection clearRequestIds()
Clears all request IDs that were added by addRequestId(java.lang.String). It is usually called after calling endWithRequest().

Returns:
a list of request IDs that were added by addRequestId(java.lang.String), or null if no request ID was added.
Since:
3.0.0


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.