gr.uoa.di.madgik.grs.proxy.mirror
Class PartialRequestManager

java.lang.Object
  extended by gr.uoa.di.madgik.grs.proxy.mirror.PartialRequestManager

public class PartialRequestManager
extends java.lang.Object

This class acts as a manager that can be used by reader side IMirror implementations to handle the requests for additional payload issued against Records and Fields that have been transfered partially.

Author:
gpapanikos

Constructor Summary
PartialRequestManager()
           
 
Method Summary
 void block(long recordIndex, int fieldIndex, IBuffer.TransportOverride override, java.lang.Object notify)
          This method is used to add one new request to the ones that are pending data to be made available
 void dispose()
          Disposes all internal resources and notifies all the waiting requesters
 PartialRequestEntry[] getEntries()
          Retrieves a new copy of the entries that are pending
 boolean requestExists(long recordIndex, int fieldIndex)
          Checks whether a request for the specific Record and Field is already pending
 void unblock(long recordIndex, int fieldIndex)
          data has been made available for the provided Record and Field.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PartialRequestManager

public PartialRequestManager()
Method Detail

block

public void block(long recordIndex,
                  int fieldIndex,
                  IBuffer.TransportOverride override,
                  java.lang.Object notify)
           throws GRS2ProxyMirrorDisposedException,
                  GRS2ProxyMirrorInvalidOperationException
This method is used to add one new request to the ones that are pending data to be made available

Parameters:
recordIndex - the Record index the request is issued against
fieldIndex - the Record's Field that should transfer more data
override - the IBuffer.TransportOverride directive to use
notify - the synchronization object used to block and notify the requester
Throws:
GRS2ProxyMirrorDisposedException - The mirroring procedure has already been terminated
GRS2ProxyMirrorInvalidOperationException - A request against the specific Record and Field has already been issued and an new one cannot be maid until the previous one is served

unblock

public void unblock(long recordIndex,
                    int fieldIndex)
             throws GRS2ProxyMirrorDisposedException,
                    GRS2ProxyMirrorInvalidOperationException
data has been made available for the provided Record and Field. This method will use the respective synchronization object to notify the requester and remove the served request

Parameters:
recordIndex - the Record index the request is issued against
fieldIndex - the Record's Field that transfered more data
Throws:
GRS2ProxyMirrorDisposedException - The mirroring procedure has already been terminated
GRS2ProxyMirrorInvalidOperationException - No request fore the given Record and Field can be found

requestExists

public boolean requestExists(long recordIndex,
                             int fieldIndex)
                      throws GRS2ProxyMirrorDisposedException
Checks whether a request for the specific Record and Field is already pending

Parameters:
recordIndex - the Record index
fieldIndex - the Field index
Returns:
true if a request exists, false otherwise
Throws:
GRS2ProxyMirrorDisposedException - The mirroring procedure has already been terminated

getEntries

public PartialRequestEntry[] getEntries()
Retrieves a new copy of the entries that are pending

Returns:
a copy of the pending entries

dispose

public void dispose()
Disposes all internal resources and notifies all the waiting requesters