com.ibm.retail.AEF.thread
Class ConditionLock

java.lang.Object
  |
  +--com.ibm.retail.AEF.thread.ConditionLock
Direct Known Subclasses:
ObjectDetectorLock

public class ConditionLock
extends java.lang.Object

An synchronization mechanism which can use an external lock.


Field Summary
protected  com.ibm.retail.AEF.action.AEFAction action
           
protected  com.ibm.retail.AEF.thread.MutexLock lock
           
protected  com.ibm.retail.AEF.util.AEFMessage msg
           
protected  java.lang.String name
           
protected  int returnIndex
           
protected  com.ibm.retail.AEF.session.AEFSession session
           
protected  int timeout
           
protected  com.ibm.retail.si.util.AEFException unblockException
           
protected  java.lang.RuntimeException unblockRuntimeException
           
 
Constructor Summary
ConditionLock()
          Constructs a ConditionLock with an internal lock object.
 
Method Summary
(package private) static java.lang.String copyright()
           
 com.ibm.retail.AEF.thread.MutexLock getLock()
          Gets the lock object for this condition variable.
 java.lang.Thread getLockOwner()
          Gets the thread which owns the lock object for this condition variable.
 void notify(com.ibm.retail.si.util.AEFException e)
          Unblock a thread waiting on this condition variable by throwing an exception on the blocked thread.
 void notify(int index)
          Notify any threads waiting on this condition variable to execute.
 void notify(java.lang.RuntimeException e)
          Unblock a thread waiting on this condition variable by throwing an exception on the blocked thread.
 int performActionAndWait(java.lang.String name, com.ibm.retail.AEF.action.AEFAction action, com.ibm.retail.AEF.automation.Condition[] conditions, com.ibm.retail.AEF.automation.Condition[] errorConditions, int timeout)
          Blocks the calling thread on the condition variable or a timeout
 int performActionAndWait(java.lang.String name, com.ibm.retail.AEF.action.AEFAction action, com.ibm.retail.AEF.automation.Condition[] conditions, com.ibm.retail.AEF.automation.Condition errorCondition, int timeout)
          Blocks the calling thread on the condition variable or a timeout
 int performActionAndWait(java.lang.String name, com.ibm.retail.AEF.action.AEFAction action, com.ibm.retail.AEF.automation.Condition[] conditions, int timeout)
          Blocks the calling thread on the condition variable or a timeout
 int performActionAndWait(java.lang.String name, com.ibm.retail.AEF.action.AEFAction action, com.ibm.retail.AEF.automation.Condition condition, int timeout)
          Blocks the calling thread on the condition variable or a timeout
 int wait(java.lang.String name, com.ibm.retail.AEF.automation.Condition[] conditions, com.ibm.retail.AEF.automation.Condition[] errorConditions, int timeout)
          Blocks the calling thread on the condition variable or a timeout
 int wait(java.lang.String name, com.ibm.retail.AEF.automation.Condition[] conditions, com.ibm.retail.AEF.automation.Condition[] errorConditions, int timeout, boolean immediateEval)
          Blocks the calling thread on the condition variable or a timeout
 int wait(java.lang.String name, com.ibm.retail.AEF.automation.Condition[] conditions, com.ibm.retail.AEF.automation.Condition errorCondition, int timeout)
          Blocks the calling thread on the condition variable or a timeout
 int wait(java.lang.String name, com.ibm.retail.AEF.automation.Condition[] conditions, com.ibm.retail.AEF.automation.Condition errorCondition, int timeout, boolean immediateEval)
          Blocks the calling thread on the condition variable or a timeout
 int wait(java.lang.String name, com.ibm.retail.AEF.automation.Condition[] conditions, int timeout)
          Blocks the calling thread on the condition variable or a timeout
 int wait(java.lang.String name, com.ibm.retail.AEF.automation.Condition[] conditions, int timeout, boolean immediateEval)
          Blocks the calling thread on the condition variable or a timeout
 int wait(java.lang.String name, com.ibm.retail.AEF.automation.Condition condition, int timeout)
          Blocks the calling thread on the condition variable or a timeout.
 int wait(java.lang.String name, com.ibm.retail.AEF.automation.Condition condition, int timeout, boolean immediateEval)
          Blocks the calling thread on the condition variable or a timeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lock

protected com.ibm.retail.AEF.thread.MutexLock lock

action

protected com.ibm.retail.AEF.action.AEFAction action

timeout

protected int timeout

unblockException

protected com.ibm.retail.si.util.AEFException unblockException

unblockRuntimeException

protected java.lang.RuntimeException unblockRuntimeException

returnIndex

protected int returnIndex

name

protected java.lang.String name

msg

protected com.ibm.retail.AEF.util.AEFMessage msg

session

protected com.ibm.retail.AEF.session.AEFSession session
Constructor Detail

ConditionLock

public ConditionLock()
Constructs a ConditionLock with an internal lock object.

Method Detail

copyright

static java.lang.String copyright()

performActionAndWait

public int performActionAndWait(java.lang.String name,
                                com.ibm.retail.AEF.action.AEFAction action,
                                com.ibm.retail.AEF.automation.Condition condition,
                                int timeout)
                         throws AEFException
Blocks the calling thread on the condition variable or a timeout

Parameters:
name - A debug aid. Give a unique name to the condition lock such as "wait-for-password-state".
action - The action which will be performed which should cause some conditions to change.
condition - The condition to wait for before returning.
timeout - The number of milliseconds to wait for the condition to be true.
Returns:
int The zero based index of the condition that evaluated to true.
Throws:
AEFException -
Because of the nature of this method just about any error code could be returned. Among the possible AEFException error codes are:
Common Errors

performActionAndWait

public int performActionAndWait(java.lang.String name,
                                com.ibm.retail.AEF.action.AEFAction action,
                                com.ibm.retail.AEF.automation.Condition[] conditions,
                                int timeout)
                         throws AEFException
Blocks the calling thread on the condition variable or a timeout

Parameters:
name - A debug aid. Give a unique name to the condition lock such as "wait-for-password-state".
action - The action which will be performed which should cause some conditions to change.
conditions - An array of conditions, one of which must evaluate to true before returning.
timeout - The number of milliseconds to wait for the condition to be true.
Returns:
int The zero based index of the condition that evaluated to true.
Throws:
AEFException -
Because of the nature of this method just about any error code could be returned. Among the possible AEFException error codes are:
Common Errors

performActionAndWait

public int performActionAndWait(java.lang.String name,
                                com.ibm.retail.AEF.action.AEFAction action,
                                com.ibm.retail.AEF.automation.Condition[] conditions,
                                com.ibm.retail.AEF.automation.Condition errorCondition,
                                int timeout)
                         throws AEFException
Blocks the calling thread on the condition variable or a timeout

Parameters:
name - A debug aid. Give a unique name to the condition lock such as "wait-for-password-state".
action - The action which will be performed which should cause some conditions to change.
conditions - An array of conditions, one of which must evaluate to true before returning.
errorCondition - A condition which will cause the calling thread to unblock if it evaluates to true.
timeout - The number of milliseconds to wait for the condition to be true.
Returns:
int The index of the condition that evaluated to true. If zero or positive, the return value represents the zero based index into the "normal" condition array. If negative one (-1) , the error condition evaluated to true.
Throws:
AEFException -
Because of the nature of this method just about any error code could be returned. Among the possible AEFException error codes are:
Common Errors

performActionAndWait

public int performActionAndWait(java.lang.String name,
                                com.ibm.retail.AEF.action.AEFAction action,
                                com.ibm.retail.AEF.automation.Condition[] conditions,
                                com.ibm.retail.AEF.automation.Condition[] errorConditions,
                                int timeout)
                         throws AEFException
Blocks the calling thread on the condition variable or a timeout

Parameters:
name - A debug aid. Give a unique name to the condition lock such as "wait-for-password-state".
action - The action which will be performed which should cause some conditions to change.
conditions - An array of conditions, one of which must evaluate to true before returning.
errorConditions - An array of conditions which will cause the calling thread to unblock if one of the conditions evaluates to true. These conditions are considered "error" conditions.
timeout - The number of milliseconds to wait for the condition to be true.
Returns:
int The index of the condition that evaluated to true. If zero or positive, the return value represents the zero based index into the "normal" condition array. If negative, the return value is the negation of the zero based index into the "error" condition array plus 1. To convert a negative return value back into a zero based index into the "error" condition array, take the absolute value, then subtract 1.
Throws:
AEFException -
Because of the nature of this method just about any error code could be returned. Among the possible AEFException error codes are:
Common Errors

wait

public int wait(java.lang.String name,
                com.ibm.retail.AEF.automation.Condition condition,
                int timeout)
         throws AEFException
Blocks the calling thread on the condition variable or a timeout. The property monitored in the condition must change before the condition is evaluated.

Parameters:
name - A debug aid. Give a unique name to the condition lock such as "wait-for-password-state".
condition - The condition must evaluate to true before returning.
timeout - The number of milliseconds to wait for the condition to be true.
Returns:
int The zero based index of the condition that evaluated to true. Will always be zero in this case.
Throws:
AEFException - Among the possible AEFException error codes are:
Common Errors

wait

public int wait(java.lang.String name,
                com.ibm.retail.AEF.automation.Condition condition,
                int timeout,
                boolean immediateEval)
         throws AEFException
Blocks the calling thread on the condition variable or a timeout

Parameters:
name - A debug aid. Give a unique name to the condition lock such as "wait-for-password-state".
condition - The condition must evaluate to true before returning.
timeout - The number of milliseconds to wait for the condition to be true.
immediateEval - If true, the conditions are evaluated immediately without first waiting for a property change.
Returns:
int The zero based index of the condition that evaluated to true.
Throws:
AEFException - Among the possible AEFException error codes are:
Common Errors

wait

public int wait(java.lang.String name,
                com.ibm.retail.AEF.automation.Condition[] conditions,
                int timeout)
         throws AEFException
Blocks the calling thread on the condition variable or a timeout

Parameters:
name - A debug aid. Give a unique name to the condition lock such as "wait-for-password-state".
conditions - An array of conditions, one of which must evaluate to true before returning.
timeout - The number of milliseconds to wait for the condition to be true.
Returns:
int The zero based index of the condition that evaluated to true.
Throws:
AEFException - Among the possible AEFException error codes are:
Common Errors

wait

public int wait(java.lang.String name,
                com.ibm.retail.AEF.automation.Condition[] conditions,
                int timeout,
                boolean immediateEval)
         throws AEFException
Blocks the calling thread on the condition variable or a timeout

Parameters:
name - A debug aid. Give a unique name to the condition lock such as "wait-for-password-state".
conditions - An array of conditions, one of which must evaluate to true before returning.
timeout - The number of milliseconds to wait for the condition to be true.
immediateEval - If true, the conditions are evaluated immediately without first waiting for a property change.
Returns:
int The zero based index of the condition that evaluated to true.
Throws:
AEFException - Among the possible AEFException error codes are:
Common Errors

wait

public int wait(java.lang.String name,
                com.ibm.retail.AEF.automation.Condition[] conditions,
                com.ibm.retail.AEF.automation.Condition[] errorConditions,
                int timeout)
         throws AEFException
Blocks the calling thread on the condition variable or a timeout

Parameters:
name - A debug aid. Give a unique name to the condition lock such as "wait-for-password-state".
conditions - An array of conditions which will cause the calling thread to unblock if one of the conditions evaluates to true. These conditions are considered "non-error" conditions.
errorConditions - An array of conditions which will cause the calling thread to unblock if one of the conditions evaluates to true. These conditions are considered "error" conditions.
timeout - The number of milliseconds to wait for the condition to be true.
Returns:
int The index of the condition that evaluated to true. If zero or positive, the return value represents the zero based index into the "normal" condition array. If negative, the return value is the negation of the zero based index into the "error" condition array plus 1. To convert a negative return value back into a zero based index into the "error" condition array, take the absolute value, then subtract 1.
Throws:
AEFException - Among the possible AEFException error codes are:
Common Errors

wait

public int wait(java.lang.String name,
                com.ibm.retail.AEF.automation.Condition[] conditions,
                com.ibm.retail.AEF.automation.Condition errorCondition,
                int timeout)
         throws AEFException
Blocks the calling thread on the condition variable or a timeout

Parameters:
name - A debug aid. Give a unique name to the condition lock such as "wait-for-password-state".
conditions - An array of conditions which will cause the calling thread to unblock if one of the conditions evaluates to true. These conditions are considered "non-error" conditions.
errorCondition - A condition which will cause the calling thread to unblock if it evaluates to true. This condition is considered and "error" condition.
timeout - The number of milliseconds to wait for the condition to be true.
Returns:
int The index of the condition that evaluated to true. If zero or positive, the return value represents the zero based index into the "normal" condition array. If negative, the return value is the negation of the zero based index into the "error" condition array plus 1. To convert a negative return value back into a zero based index into the "error" condition array, take the absolute value, then subtract 1.
Throws:
AEFException - Among the possible AEFException error codes are:
Common Errors

wait

public int wait(java.lang.String name,
                com.ibm.retail.AEF.automation.Condition[] conditions,
                com.ibm.retail.AEF.automation.Condition errorCondition,
                int timeout,
                boolean immediateEval)
         throws AEFException
Blocks the calling thread on the condition variable or a timeout

Parameters:
name - A debug aid. Give a unique name to the condition lock such as "wait-for-password-state".
conditions - An array of conditions which will cause the calling thread to unblock if one of the conditions evaluates to true. These conditions are considered "non-error" conditions.
errorCondition - A condition which will cause the calling thread to unblock if it evaluates to true. This condition is considered and "error" condition.
timeout - The number of milliseconds to wait for the condition to be true.
immediateEval - If true, the conditions are evaluated immediately without first waiting for a property change.
Returns:
int The index of the condition that evaluated to true. If zero or positive, the return value represents the zero based index into the "normal" condition array. If negative, the return value is the negation of the zero based index into the "error" condition array plus 1. To convert a negative return value back into a zero based index into the "error" condition array, take the absolute value, then subtract 1.
Throws:
AEFException - Among the possible AEFException error codes are:
Common Errors

wait

public int wait(java.lang.String name,
                com.ibm.retail.AEF.automation.Condition[] conditions,
                com.ibm.retail.AEF.automation.Condition[] errorConditions,
                int timeout,
                boolean immediateEval)
         throws AEFException
Blocks the calling thread on the condition variable or a timeout

Parameters:
name - A debug aid. Give a unique name to the condition lock such as "wait-for-password-state".
conditions - An array of conditions which will cause the calling thread to unblock if one of the conditions evaluates to true. These conditions are considered "non-error" conditions.
errorConditions - An array of conditions which will cause the calling thread to unblock if one of the conditions evaluates to true. These conditions are considered "error" conditions.
timeout - The number of milliseconds to wait for the condition to be true.
immediateEval - If true, the conditions are evaluated immediately without first waiting for a property change.
Returns:
int The index of the condition that evaluated to true. If zero or positive, the return value represents the zero based index into the "normal" condition array. If negative, the return value is the negation of the zero based index into the "error" condition array plus 1. To convert a negative return value back into a zero based index into the "error" condition array, take the absolute value, then subtract 1.
Throws:
AEFException - Among the possible AEFException error codes are:
Common Errors

notify

public void notify(com.ibm.retail.si.util.AEFException e)
Unblock a thread waiting on this condition variable by throwing an exception on the blocked thread.

Parameters:
e - The exception to throw on the blocked thread.

notify

public void notify(java.lang.RuntimeException e)
Unblock a thread waiting on this condition variable by throwing an exception on the blocked thread.

Parameters:
e - The exception to throw on the blocked thread.

notify

public void notify(int index)
Notify any threads waiting on this condition variable to execute.


getLock

public com.ibm.retail.AEF.thread.MutexLock getLock()
Gets the lock object for this condition variable.

Returns:
MutexLock

getLockOwner

public java.lang.Thread getLockOwner()
Gets the thread which owns the lock object for this condition variable.

Returns:
Thread


Copyright © 2004 IBM. All Rights Reserved.
Generated: July 19 2004