GigaSpaces XAP 9.7.2 API

com.sun.jini.thread
Class InProgress

java.lang.Object
  extended by com.sun.jini.thread.InProgress

public class InProgress
extends Object

This class provides a blocking mechanism that will not proceed while some operation bounded by this object is in progress. The thread performing the operation invokes start and stop on this object when it starts and stops the operation in progress. The thread that wants to block itself while the operation is in progress invokes waitWhileStarted, which will block if start has been invoked without a matching stop. The block will continue until a matching stop is invoked. Each start adds one to the number of operations; each stop subtracts one. When the number of operations is zero, the operation bounded by this object is not in progress, and waitWhileStarted will return.

The operation can also be blocked by invoking block and unblock, which nest like start and stop. When a block is invoked on this object, no start will proceed until the matching unblock call is made. The reverse is also true: when a stop call has been made on this object, no block call will proceed until the matching stop call is made. A waitUntilUnblocked method allows selective waiting for the unblocked state without invoking start.

A waitUntilQuiet call waits until the object is neither blocked nor stopped.

Author:
Sun Microsystems, Inc.

Constructor Summary
InProgress(String name)
           
 
Method Summary
 void block()
          Signal the blocking of the operation this object bounds.
 boolean blocked()
          Return true if at least one block has been invoked without its corresponding unblock.
 void debug(boolean debugOn)
          Set the debug mode on or off.
 boolean inProgress()
          Return true if at least one start has been invoked without its corresponding stop.
 void start()
          Signal the start of the operation this object bounds.
 void stop()
          Signal the stop of the operation this object bounds.
 void unblock()
          Signal the unblocking of the operation this object bounds.
 void waitUntilQuiet()
          Wait if the operation bounded by this object is either started or blocked.
 void waitWhileBlocked()
          Wait if the operation bounded by this object has been blocked, i.e., between a block and a unblock.
 void waitWhileStarted()
          Wait if the operation bounded by this object is in progress, i.e., between a start and a stop.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InProgress

public InProgress(String name)
Method Detail

start

public void start()
           throws InterruptedException
Signal the start of the operation this object bounds.

Throws:
InterruptedException

stop

public void stop()
Signal the stop of the operation this object bounds.


inProgress

public boolean inProgress()
Return true if at least one start has been invoked without its corresponding stop.


waitWhileStarted

public void waitWhileStarted()
                      throws InterruptedException
Wait if the operation bounded by this object is in progress, i.e., between a start and a stop.

Throws:
InterruptedException

block

public void block()
           throws InterruptedException
Signal the blocking of the operation this object bounds.

Throws:
InterruptedException

unblock

public void unblock()
Signal the unblocking of the operation this object bounds.


blocked

public boolean blocked()
Return true if at least one block has been invoked without its corresponding unblock.


waitWhileBlocked

public void waitWhileBlocked()
                      throws InterruptedException
Wait if the operation bounded by this object has been blocked, i.e., between a block and a unblock.

Throws:
InterruptedException

waitUntilQuiet

public void waitUntilQuiet()
                    throws InterruptedException
Wait if the operation bounded by this object is either started or blocked.

Throws:
InterruptedException

debug

public void debug(boolean debugOn)
Set the debug mode on or off.


GigaSpaces XAP 9.7.2 API

Copyright © GigaSpaces.