Skip to content

Commit

Permalink
Allow CounterService, ExecutionService, LockService to operate on For…
Browse files Browse the repository at this point in the history
…kChannel.
  • Loading branch information
pferraro committed Feb 2, 2015
1 parent 883cf5a commit 38c7836
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/org/jgroups/blocks/atomic/CounterService.java
@@ -1,6 +1,6 @@
package org.jgroups.blocks.atomic; package org.jgroups.blocks.atomic;


import org.jgroups.JChannel; import org.jgroups.Channel;
import org.jgroups.protocols.COUNTER; import org.jgroups.protocols.COUNTER;


/** /**
Expand All @@ -9,14 +9,14 @@
* @since 3.0.0 * @since 3.0.0
*/ */
public class CounterService { public class CounterService {
protected JChannel ch; protected Channel ch;
protected COUNTER counter_prot; protected COUNTER counter_prot;


public CounterService(JChannel ch) { public CounterService(Channel ch) {
setChannel(ch); setChannel(ch);
} }


public void setChannel(JChannel ch) { public void setChannel(Channel ch) {
this.ch=ch; this.ch=ch;
counter_prot=(COUNTER)ch.getProtocolStack().findProtocol(COUNTER.class); counter_prot=(COUNTER)ch.getProtocolStack().findProtocol(COUNTER.class);
if(counter_prot == null) if(counter_prot == null)
Expand Down
14 changes: 7 additions & 7 deletions src/org/jgroups/blocks/executor/ExecutionService.java
Expand Up @@ -24,7 +24,7 @@
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;


import org.jgroups.JChannel; import org.jgroups.Channel;
import org.jgroups.protocols.Executing; import org.jgroups.protocols.Executing;
import org.jgroups.util.FutureListener; import org.jgroups.util.FutureListener;
import org.jgroups.util.NotifyingFuture; import org.jgroups.util.NotifyingFuture;
Expand All @@ -50,7 +50,7 @@
* @since 2.12.0 * @since 2.12.0
*/ */
public class ExecutionService extends AbstractExecutorService { public class ExecutionService extends AbstractExecutorService {
protected JChannel ch; protected Channel ch;
protected Executing _execProt; protected Executing _execProt;


protected Lock _unfinishedLock = new ReentrantLock(); protected Lock _unfinishedLock = new ReentrantLock();
Expand All @@ -64,11 +64,11 @@ public ExecutionService() {


} }


public ExecutionService(JChannel ch) { public ExecutionService(Channel ch) {
setChannel(ch); setChannel(ch);
} }


public void setChannel(JChannel ch) { public void setChannel(Channel ch) {
this.ch=ch; this.ch=ch;
_execProt=(Executing)ch.getProtocolStack().findProtocol(Executing.class); _execProt=(Executing)ch.getProtocolStack().findProtocol(Executing.class);
if(_execProt == null) if(_execProt == null)
Expand Down Expand Up @@ -110,7 +110,7 @@ public String toString() {
protected final Sync<V> sync; protected final Sync<V> sync;


/** The following values are only used on the client side */ /** The following values are only used on the client side */
private final JChannel channel; private final Channel channel;
private final Set<Future<?>> _unfinishedFutures; private final Set<Future<?>> _unfinishedFutures;
private final Lock _unfinishedLock; private final Lock _unfinishedLock;
private final Condition _unfinishedCondition; private final Condition _unfinishedCondition;
Expand All @@ -128,7 +128,7 @@ public String toString() {
* it is finished. * it is finished.
* @param callable The callable to actually run on the server side * @param callable The callable to actually run on the server side
*/ */
public DistributedFuture(JChannel channel, Lock unfinishedLock, public DistributedFuture(Channel channel, Lock unfinishedLock,
Condition condition, Condition condition,
Set<Future<?>> futuresToFinish, Set<Future<?>> futuresToFinish,
Callable<V> callable) { Callable<V> callable) {
Expand Down Expand Up @@ -160,7 +160,7 @@ public DistributedFuture(JChannel channel, Lock unfinishedLock,
* <tt>Future&lt;?&gt; f = new FutureTask&lt;Object&gt;(runnable, null)</tt> * <tt>Future&lt;?&gt; f = new FutureTask&lt;Object&gt;(runnable, null)</tt>
* @throws NullPointerException if runnable is null * @throws NullPointerException if runnable is null
*/ */
public DistributedFuture(JChannel channel, Lock unfinishedLock, public DistributedFuture(Channel channel, Lock unfinishedLock,
Condition condition, Set<Future<?>> futuresToFinish, Condition condition, Set<Future<?>> futuresToFinish,
Runnable runnable, V result) { Runnable runnable, V result) {
sync = new Sync<V>(this, new RunnableAdapter<V>(runnable, result)); sync = new Sync<V>(this, new RunnableAdapter<V>(runnable, result));
Expand Down
10 changes: 5 additions & 5 deletions src/org/jgroups/blocks/locking/LockService.java
@@ -1,7 +1,7 @@
package org.jgroups.blocks.locking; package org.jgroups.blocks.locking;


import org.jgroups.Event; import org.jgroups.Event;
import org.jgroups.JChannel; import org.jgroups.Channel;
import org.jgroups.protocols.Locking; import org.jgroups.protocols.Locking;


import java.util.Date; import java.util.Date;
Expand All @@ -12,7 +12,7 @@


/** /**
* LockService is the main class for to use for distributed locking functionality. LockService needs access to a * LockService is the main class for to use for distributed locking functionality. LockService needs access to a
* {@link JChannel} and interacts with a locking protocol (e.g. {@link org.jgroups.protocols.CENTRAL_LOCK}) via events.<p/> * {@link Channel} and interacts with a locking protocol (e.g. {@link org.jgroups.protocols.CENTRAL_LOCK}) via events.<p/>
* When no locking protocol is seen on the channel's stack, LockService will throw an exception at startup. An example * When no locking protocol is seen on the channel's stack, LockService will throw an exception at startup. An example
* of using LockService is: * of using LockService is:
* <pre> * <pre>
Expand All @@ -37,19 +37,19 @@
* @since 2.12 * @since 2.12
*/ */
public class LockService { public class LockService {
protected JChannel ch; protected Channel ch;
protected Locking lock_prot; protected Locking lock_prot;




public LockService() { public LockService() {


} }


public LockService(JChannel ch) { public LockService(Channel ch) {
setChannel(ch); setChannel(ch);
} }


public void setChannel(JChannel ch) { public void setChannel(Channel ch) {
this.ch=ch; this.ch=ch;
lock_prot=(Locking)ch.getProtocolStack().findProtocol(Locking.class); lock_prot=(Locking)ch.getProtocolStack().findProtocol(Locking.class);
if(lock_prot == null) if(lock_prot == null)
Expand Down

0 comments on commit 38c7836

Please sign in to comment.