com.ontimize.util.gis.client.defaultimplementations.cache
Class RequestQueryWithBuffer

java.lang.Object
  extended by com.ontimize.util.gis.client.defaultimplementations.cache.RequestQueryWithBuffer
All Implemented Interfaces:
IRequestQuery

public class RequestQueryWithBuffer
extends java.lang.Object
implements IRequestQuery

Request query with a fixed size requests stack.
When a new request arrives and the current stack has the maximum size the first request in the stack is deleted and the new request is added to the current stack.


Field Summary
protected  int bufferSize
           
protected  java.util.concurrent.locks.Condition emptyQueryCondition
           
protected  java.util.Hashtable<java.lang.Object,java.lang.Object> lastTickets
           
protected  java.util.Stack<java.lang.Object> queryData
           
protected  java.util.concurrent.locks.Lock queryLock
           
 
Fields inherited from interface com.ontimize.util.gis.client.defaultimplementations.cache.IRequestQuery
PARAMETER_REQUEST_DATA, PARAMETER_REQUESTER_ID
 
Constructor Summary
RequestQueryWithBuffer()
           
RequestQueryWithBuffer(int bufferSize)
          Request query with buffer constructor
 
Method Summary
 void addRequest(java.lang.Object requestData, java.lang.Object requesterId)
          Add a new data request to the pending requests stack
 java.util.concurrent.locks.Condition getEmptyCondition()
          Get the empty stack condition reference
 java.util.concurrent.locks.Lock getLock()
          Get the reference of the pending requests stack lock
 int getQueriesStackSize()
           
 java.lang.Object getRequest()
          Get the new pending request located at the top of the stack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

queryLock

protected java.util.concurrent.locks.Lock queryLock

bufferSize

protected int bufferSize

emptyQueryCondition

protected java.util.concurrent.locks.Condition emptyQueryCondition

lastTickets

protected java.util.Hashtable<java.lang.Object,java.lang.Object> lastTickets

queryData

protected java.util.Stack<java.lang.Object> queryData
Constructor Detail

RequestQueryWithBuffer

public RequestQueryWithBuffer()

RequestQueryWithBuffer

public RequestQueryWithBuffer(int bufferSize)
Request query with buffer constructor

Parameters:
bufferSize - Maximum allowable stack size
Method Detail

getEmptyCondition

public java.util.concurrent.locks.Condition getEmptyCondition()
Description copied from interface: IRequestQuery
Get the empty stack condition reference

Specified by:
getEmptyCondition in interface IRequestQuery
Returns:
Empty request stack condition

getLock

public java.util.concurrent.locks.Lock getLock()
Description copied from interface: IRequestQuery
Get the reference of the pending requests stack lock

Specified by:
getLock in interface IRequestQuery
Returns:
Stack lock

addRequest

public void addRequest(java.lang.Object requestData,
                       java.lang.Object requesterId)
Description copied from interface: IRequestQuery
Add a new data request to the pending requests stack

Specified by:
addRequest in interface IRequestQuery
Parameters:
requestData - Requested data description
requesterId - Identifier for the requesting class

getRequest

public java.lang.Object getRequest()
Description copied from interface: IRequestQuery
Get the new pending request located at the top of the stack

Specified by:
getRequest in interface IRequestQuery
Returns:
First pending request

getQueriesStackSize

public int getQueriesStackSize()
Specified by:
getQueriesStackSize in interface IRequestQuery