| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.hazelcast.client.spi.ClientProxy
com.hazelcast.client.proxy.ClientSemaphoreProxy
public class ClientSemaphoreProxy
| Constructor Summary | |
|---|---|
| ClientSemaphoreProxy(String serviceName,
                     String objectId) | |
| Method Summary | ||
|---|---|---|
|  void | acquire()Acquires a permit if one is available, and returns immediately, reducing the number of available permits by one. | |
|  void | acquire(int permits)Acquires the given number of permits if they are available, and returns immediately, reducing the number of available permits by the given amount. | |
|  int | availablePermits()Returns the current number of permits currently available in this semaphore. | |
|  int | drainPermits()Acquires and returns all permits that are immediately available. | |
|  Data | getKey() | |
|  boolean | init(int permits)Try to initialize this ISemaphore instance with the given permit count | |
| protected 
 | invoke(ClientRequest req) | |
|  void | reducePermits(int reduction)Shrinks the number of available permits by the indicated reduction. | |
|  void | release()Releases a permit, increasing the number of available permits by one. | |
|  void | release(int permits)Releases the given number of permits, increasing the number of available permits by that amount. | |
|  String | toString() | |
|  boolean | tryAcquire()Acquires a permit, if one is available and returns immediately, with the value true,
 reducing the number of available permits by one. | |
|  boolean | tryAcquire(int permits)Acquires the given number of permits, if they are available, and returns immediately, with the value true,
 reducing the number of available permits by the given amount. | |
|  boolean | tryAcquire(int permits,
           long timeout,
           TimeUnit unit)Acquires the given number of permits if they are available and returns immediately with the value true,
 reducing the number of available permits by the given amount. | |
|  boolean | tryAcquire(long timeout,
           TimeUnit unit)Acquires a permit from this semaphore if one becomes available within the given waiting time and the current thread has not been interrupted. | |
| Methods inherited from class com.hazelcast.client.spi.ClientProxy | 
|---|
| destroy, equals, getContext, getId, getName, getPartitionKey, getServiceName, hashCode, invoke, invoke, invokeInterruptibly, listen, listen, onDestroy, onInitialize, onShutdown, setContext, stopListening, throwExceptionIfNull, toData, toObject | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, finalize, getClass, notify, notifyAll, wait, wait, wait | 
| Methods inherited from interface com.hazelcast.core.ISemaphore | 
|---|
| getName | 
| Methods inherited from interface com.hazelcast.core.DistributedObject | 
|---|
| destroy, getId, getPartitionKey, getServiceName | 
| Constructor Detail | 
|---|
public ClientSemaphoreProxy(String serviceName,
                            String objectId)
| Method Detail | 
|---|
public boolean init(int permits)
ISemaphore
init in interface ISemaphorepermits - the given permit count
public void acquire()
             throws InterruptedException
ISemaphoreAcquires a permit if one is available, and returns immediately, reducing the number of available permits by one.
If no permit is available, then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of three things happens:
ISemaphore.release() methods for this
 semaphore and the current thread is next to be assigned a permit,
 If the current thread:
InterruptedException is thrown and the current thread's
 interrupted status is cleared.
acquire in interface ISemaphoreInterruptedException - if the current thread is interrupted
public void acquire(int permits)
             throws InterruptedException
ISemaphoreAcquires the given number of permits if they are available, and returns immediately, reducing the number of available permits by the given amount.
If insufficient permits are available then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of three things happens:
release
 methods for this semaphore, the current thread is next to be assigned
 permits and the number of available permits satisfies this request,
 If the current thread:
InterruptedException is thrown and the current thread's
 interrupted status is cleared.
acquire in interface ISemaphorepermits - the number of permits to acquire
InterruptedException - if the current thread is interruptedpublic int availablePermits()
ISemaphore
availablePermits in interface ISemaphorepublic int drainPermits()
ISemaphore
drainPermits in interface ISemaphorepublic void reducePermits(int reduction)
ISemaphoreacquire in that it does not
 block waiting for permits to become available.
reducePermits in interface ISemaphorereduction - the number of permits to removepublic void release()
ISemaphoreacquire methods.
 Correct usage of a semaphore is established by programming convention
 in the application.
release in interface ISemaphorepublic void release(int permits)
ISemaphoreacquire methods.
 Correct usage of a semaphore is established by programming convention
 in the application.
release in interface ISemaphorepermits - the number of permits to releasepublic boolean tryAcquire()
ISemaphoretrue,
 reducing the number of available permits by one.
 
 If no permit is available then this method will return
 immediately with the value false.
tryAcquire in interface ISemaphoretrue if a permit was acquired and false
         otherwisepublic boolean tryAcquire(int permits)
ISemaphoretrue,
 reducing the number of available permits by the given amount.
 
 If insufficient permits are available then this method will return
 immediately with the value false and the number of available
 permits is unchanged.
tryAcquire in interface ISemaphorepermits - the number of permits to acquire
true if the permits were acquired and
         false otherwise
public boolean tryAcquire(long timeout,
                          TimeUnit unit)
                   throws InterruptedException
ISemaphoretrue,
 reducing the number of available permits by one.
 
 If no permit is available, then the current thread becomes
 disabled for thread scheduling purposes and lies dormant until
 one of three things happens:
 ISemaphore.release() method for this
 semaphore and the current thread is next to be assigned a permit, or
 true is returned.
 
 If the specified waiting time elapses then the value false
 is returned.  If the time is less than or equal to zero, the method
 will not wait at all.
 
 If the current thread:
InterruptedException is thrown and the current thread's
 interrupted status is cleared.
tryAcquire in interface ISemaphoretimeout - the maximum time to wait for a permitunit - the time unit of the timeout argument
true if a permit was acquired and false
         if the waiting time elapsed before a permit was acquired
InterruptedException - if the current thread is interrupted
public boolean tryAcquire(int permits,
                          long timeout,
                          TimeUnit unit)
                   throws InterruptedException
ISemaphoretrue,
 reducing the number of available permits by the given amount.
 
 If insufficient permits are available, then
 the current thread becomes disabled for thread scheduling
 purposes and lies dormant until one of three things happens:
 release
 methods for this semaphore, the current thread is next to be assigned
 permits and the number of available permits satisfies this request, or
 true is returned.
 
 If the specified waiting time elapses then false
 is returned.  If the time is less than or equal to zero, the method
 will not wait at all.
 
 If the current thread:
InterruptedException is thrown and the current thread's
 interrupted status is cleared.
tryAcquire in interface ISemaphorepermits - the number of permits to acquiretimeout - the maximum time to wait for the permitsunit - the time unit of the timeout argument
true if all permits were acquired, false
         if the waiting time elapsed before all permits could be acquired
InterruptedException - if the current thread is interruptedprotected <T> T invoke(ClientRequest req)
invoke in class ClientProxypublic Data getKey()
public String toString()
toString in class Object| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||