org.infinispan.remoting.transport.jgroups
Class JGroupsDistSync

java.lang.Object
  extended by org.infinispan.remoting.transport.jgroups.JGroupsDistSync
All Implemented Interfaces:
DistributedSync

@ThreadSafe
public class JGroupsDistSync
extends Object
implements DistributedSync

A DistributedSync based on JGroups' FLUSH protocol

Since:
4.0
Author:
Manik Surtani

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.infinispan.remoting.transport.DistributedSync
DistributedSync.SyncResponse
 
Constructor Summary
JGroupsDistSync()
           
 
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(boolean exclusive)
          Releases any processing locks that may be held by the current thread.
 void releaseSync()
          Releases the sync.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JGroupsDistSync

public JGroupsDistSync()
Method Detail

blockUntilAcquired

public DistributedSync.SyncResponse blockUntilAcquired(long timeout,
                                                       TimeUnit timeUnit)
                                                throws TimeoutException
Description copied from interface: DistributedSync
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.

Specified by:
blockUntilAcquired in interface DistributedSync
Parameters:
timeout - timeout after which to give up
timeUnit - time unit
Throws:
TimeoutException - if waiting for the sync times out.

blockUntilReleased

public DistributedSync.SyncResponse blockUntilReleased(long timeout,
                                                       TimeUnit timeUnit)
                                                throws TimeoutException
Description copied from interface: DistributedSync
Blocks until an ongoing sync ends. This is returns immediately if there is no ongoing sync.

Specified by:
blockUntilReleased in interface DistributedSync
Parameters:
timeout - timeout after which to give up
timeUnit - time unit
Throws:
TimeoutException - if waiting for an ongoing sync to end times out.

acquireSync

public void acquireSync()
Description copied from interface: DistributedSync
Acquires the sync. This could be from a local or remote source.

Specified by:
acquireSync in interface DistributedSync

releaseSync

public void releaseSync()
Description copied from interface: DistributedSync
Releases the sync. This could be from a local or remote source.

Specified by:
releaseSync in interface DistributedSync

acquireProcessingLock

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

Specified by:
acquireProcessingLock in interface DistributedSync
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

releaseProcessingLock

public void releaseProcessingLock(boolean exclusive)
Description copied from interface: DistributedSync
Releases any processing locks that may be held by the current thread.

Specified by:
releaseProcessingLock in interface DistributedSync

-->

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