org.sapia.ubik.rmi.server.command
Class ResponseLock

java.lang.Object
  extended by org.sapia.ubik.rmi.server.command.ResponseLock

public class ResponseLock
extends java.lang.Object

A client-side lock on which the caller of an asynchronous call-back waits for the corresponding call-back's response.

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2003 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site

Method Summary
 java.lang.String getId()
          Returns this lock's unique identifier.
 void release()
          Releases this lock (clears it from memory).
 void setResponse(java.lang.Object r)
          Sets this lock's response.
 java.lang.Object waitResponse(long timeout)
          Waits for the response of an asynchronous call-back.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getId

public java.lang.String getId()
Returns this lock's unique identifier.

Returns:
a unique identifier as a String.

release

public void release()
Releases this lock (clears it from memory).


waitResponse

public java.lang.Object waitResponse(long timeout)
                              throws java.lang.InterruptedException,
                                     ResponseTimeOutException
Waits for the response of an asynchronous call-back. The caller will wait for the length of time specified by the given timeout; if no response comes in before the given timeout, a ResponseTimeOutException is thrown.

Parameters:
timeout - a timeout, in milliseconds.
Returns:
a response, as an Object.
Throws:
ResponseTimeOutException - if no response comes in before the specified timeout.
java.lang.InterruptedException - if the caller is interrupted while waiting for the response.

setResponse

public void setResponse(java.lang.Object r)
Sets this lock's response.

Parameters:
an - Object corresponding to an asynchronous response.


Copyright © 2010 Sapia OSS. All Rights Reserved.