public class SEMState
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
MAX_STATE |
static int |
MIN_STATE |
protected java.util.concurrent.Semaphore |
sem |
static java.lang.String[] |
STATE_DESC |
static int |
STATE_INVALID |
static int |
STATE_POSTED |
static int |
STATE_RELEASED |
static int |
STATE_REQUESTED |
static int |
STATE_RESET |
static int |
STATE_WAITING |
Constructor and Description |
---|
SEMState(java.lang.String itemname,
int itemstate)
Creates a default Semaphore controlled item.
|
Modifier and Type | Method and Description |
---|---|
com.ibm.staf.STAFResult |
addWaiter()
Blocks the calling thread--which should be from an EmbeddedHandle--until the item is triggered with another thread's call to releaseWaiters.
|
com.ibm.staf.STAFResult |
addWaiter(long msTimeout)
Blocks the calling thread--which should be from an EmbeddedHandle--
until the item is triggered with another thread's call to releaseWaiters or the timeout has been reached.
|
void |
addWaiterId(java.lang.String waitername) |
java.lang.String |
getItemName() |
int |
getItemState() |
java.lang.String |
getStateDesc()
Return a description of the current item state.
|
java.util.Vector<java.lang.String> |
getWaiterIds() |
boolean |
hasWaiters() |
void |
releaseWaiters()
Release all waiters currently registered for the item.
|
void |
removeWaiterId(java.lang.String waitername) |
protected void |
setItemState(int state) |
public static final int MIN_STATE
public static final int STATE_WAITING
public static final int STATE_POSTED
public static final int STATE_RESET
public static final int STATE_REQUESTED
public static final int STATE_RELEASED
public static final int MAX_STATE
public static final int STATE_INVALID
public static final java.lang.String[] STATE_DESC
protected java.util.concurrent.Semaphore sem
public SEMState(java.lang.String itemname, int itemstate)
itemname
- itemstate
- java.lang.IllegalArgumentException
- if itemname or itemstate are invalid.public java.lang.String getItemName()
public int getItemState()
protected void setItemState(int state)
public void addWaiterId(java.lang.String waitername)
public void removeWaiterId(java.lang.String waitername)
public java.util.Vector<java.lang.String> getWaiterIds()
public java.lang.String getStateDesc() throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public boolean hasWaiters()
public void releaseWaiters()
public com.ibm.staf.STAFResult addWaiter() throws java.lang.InterruptedException
Example call from an EmbeddedHandle:
java.lang.InterruptedException
public com.ibm.staf.STAFResult addWaiter(long msTimeout) throws java.lang.InterruptedException
Example call from an EmbeddedHandle:
java.lang.InterruptedException
- if the waiting thread gets interrupted.Copyright © SAS Institute. All Rights Reserved.