Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More post WF9a1 updates, mostly jgroups related
  • Loading branch information
jcrossley3 committed Mar 23, 2015
1 parent a7df045 commit 9ce817f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Expand Up @@ -37,24 +37,26 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.lang.reflect.Method;


public class ChannelWrapper extends ReceiverAdapter implements RequestHandler, Component {
public ChannelWrapper(String name) {
this.name = name;
}

@Override
public void start() throws Exception {
public synchronized void start() throws Exception {
if (this.channel == null) {
this.channel = ClusterUtils.lockableChannel(this.name);
this.dispatcher = new MessageDispatcher(this.channel, null, this, this);
this.lockService = new LockService(this.channel);
setLockService();
this.channel.connect(WunderBoss.options().getString("deployment-name"));
}
}

@Override
public void stop() throws Exception {
public synchronized void stop() throws Exception {
if (this.channel != null) {
this.channel.disconnect();
this.channel.close();
Expand Down Expand Up @@ -122,6 +124,18 @@ public Object handle(Message msg) throws Exception {
return null;
}

private void setLockService() throws Exception {
Method setter = null;
for (Method m: LockService.class.getMethods()) {
if ("setChannel".equals(m.getName())) {
setter = m;
break;
}
}
this.lockService = LockService.class.newInstance();
setter.invoke(this.lockService, this.channel);
}

private final String name;
private JChannel channel;
private MessageDispatcher dispatcher;
Expand Down
Expand Up @@ -8,6 +8,7 @@
<module name="io.undertow.websocket"/>
<module name="org.jboss.modules"/>
<module name="org.wildfly.extension.undertow"/>
<module name="org.wildfly.clustering.jgroups.api" optional="true"/>
<module name="org.jboss.as.clustering.jgroups" optional="true"/>
<module name="org.jgroups" optional="true"/>
<module name="org.infinispan"/>
Expand Down

0 comments on commit 9ce817f

Please sign in to comment.