IBM Rational Performance Tester SDK

com.ibm.rational.test.lt.kernel.action
Interface IKSemaphore

All Known Subinterfaces:
ICondition, IContainer, IEngine, IFor, IIf, IKAction, IKChannel, IKLoadTestSchedule, IKTransaction, IKUserGroup, ILoop, IPacedLoop, IParallel, IWhile
All Known Implementing Classes:
com.ibm.rational.test.lt.kernel.action.impl.Container, com.ibm.rational.test.lt.kernel.action.impl.KAction, KCatchRPTEvent, com.ibm.rational.test.lt.kernel.action.impl.KContainer, com.ibm.rational.test.lt.kernel.action.impl.KScript, LTTestScript

public interface IKSemaphore


Method Summary
 void acquire(IKAction action, int permits)
          Acquires the given number of permits from this semaphore, blocking until all are available.
 int availablePermits()
          Returns the current number of permits available in this semaphore.
 Map getQueue()
          Get the actions waiting on the semaphore.
 int getQueueLength()
          Returns the number of actions waiting to acquire.
 int reducePermits(int reduction)
          Shrinks the number of available permits by the indicated reduction.
 void release()
          Releases a permit, returning it to the semaphore.
 void release(int permits)
          Releases the given number of permits, returning them to the semaphore.
 String toString()
          Returns a string identifying this semaphore, as well as its state.
 boolean tryAcquire()
          Acquires a permit from this semaphore, only if one is available at the time of invocation.
 boolean tryAcquire(int permits)
          Acquires the given number of permits from this semaphore, only if all are available at the time of invocation.
 

Method Detail

acquire

void acquire(IKAction action,
             int permits)
Acquires the given number of permits from this semaphore, blocking until all are available. Action execute() is called again when the resource is available. No further processing should occur after calling acquire(). Acquire 0 permits for a binary semaphore, which should be initialized to -1.


availablePermits

int availablePermits()
Returns the current number of permits available in this semaphore.


getQueueLength

int getQueueLength()
Returns the number of actions waiting to acquire.


reducePermits

int reducePermits(int reduction)
Shrinks the number of available permits by the indicated reduction.


release

void release()
Releases a permit, returning it to the semaphore.


release

void release(int permits)
Releases the given number of permits, returning them to the semaphore.


toString

String toString()
Returns a string identifying this semaphore, as well as its state.

Overrides:
toString in class Object

tryAcquire

boolean tryAcquire()
Acquires a permit from this semaphore, only if one is available at the time of invocation.


tryAcquire

boolean tryAcquire(int permits)
Acquires the given number of permits from this semaphore, only if all are available at the time of invocation.


getQueue

Map getQueue()
Get the actions waiting on the semaphore.

Returns:
Queue of waiting actions.

IBM Rational Performance Tester SDK

© Copyright IBM Corp. 2012. All rights reserved.