org.infinispan.remoting.transport
Interface DistributedSync

All Known Implementing Classes:
JGroupsDistSync

@ThreadSafe
public interface DistributedSync

This is an abstraction of a cluster-wide synchronization. Its purpose is to maintain a set of locks that are aware of block and unblock commands issued across a cluster. In addition to these block and unblock phases, sub-phases such as a start processing

Since:
4.0
Author:
Manik Surtani

Nested Class Summary
static class DistributedSync.SyncResponse
           
 
Method Summary
 void acquireProcessingLock(boolean exclusive, long timeout, TimeUnit timeUnit)
          Acquires a processing lock.
 void acquireSync()
          Acquires the sync.
 DistributedSync.SyncResponse blockUntilAcquired(long timeout, TimeUnit timeUnit)
          Blocks until the start of a sync - either by the current RPCManager instance or a remote one - is received.
 DistributedSync.SyncResponse blockUntilReleased(long timeout, TimeUnit timeUnit)
          Blocks until an ongoing sync ends.
 void releaseProcessingLock()
          Releases any processing locks that may be held by the current thread.
 void releaseSync()
          Releases the sync.
 

Method Detail

blockUntilAcquired

DistributedSync.SyncResponse blockUntilAcquired(long timeout,
                                                TimeUnit timeUnit)
                                                throws TimeoutException,
                                                       InterruptedException
Blocks until the start of a sync - either by the current RPCManager instance or a remote one - is received. This should return immediately if sync is already in progress.

Parameters:
timeout - timeout after which to give up
timeUnit - time unit
Throws:
TimeoutException - if waiting for the sync times out.
InterruptedException

blockUntilReleased

DistributedSync.SyncResponse blockUntilReleased(long timeout,
                                                TimeUnit timeUnit)
                                                throws TimeoutException,
                                                       InterruptedException
Blocks until an ongoing sync ends. This is returns immediately if there is no ongoing sync.

Parameters:
timeout - timeout after which to give up
timeUnit - time unit
Throws:
TimeoutException - if waiting for an ongoing sync to end times out.
InterruptedException

acquireSync

void acquireSync()
Acquires the sync. This could be from a local or remote source.


releaseSync

void releaseSync()
Releases the sync. This could be from a local or remote source.


acquireProcessingLock

void acquireProcessingLock(boolean exclusive,
                           long timeout,
                           TimeUnit timeUnit)
                           throws TimeoutException,
                                  InterruptedException
Acquires a processing lock. This is typically acquired after the sync is acquired, and is meant for local (not remote) use.

Parameters:
exclusive - whether the lock is exclusive
timeout - timeout after which to give up
timeUnit - time unit
Throws:
TimeoutException - if waiting for the lock times out
InterruptedException

releaseProcessingLock

void releaseProcessingLock()
Releases any processing locks that may be held by the current thread.


Google Analytics

Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.