Skip to content
This repository has been archived by the owner on Jun 7, 2021. It is now read-only.

Commit

Permalink
Modify examples to have a customised JGroups configuration.
Browse files Browse the repository at this point in the history
This is to get around the JGroups issue noted here:
https://issues.jboss.org/browse/WFCORE-1119
  • Loading branch information
lance committed Nov 24, 2015
1 parent 0e87286 commit dcbc460
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
Expand Up @@ -3,6 +3,7 @@
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.wildfly.swarm.container.Container;
import org.wildfly.swarm.jaxrs.JAXRSArchive;
import org.wildfly.swarm.jgroups.JGroupsFraction;
import org.wildfly.swarm.netflix.ribbon.RibbonArchive;

/**
Expand All @@ -12,6 +13,41 @@ public class Main {

public static void main(String[] args) throws Exception {
Container container = new Container();
JGroupsFraction fraction = new JGroupsFraction()
.defaultChannel( "swarm-jgroups")
.stack( "udp", (s)->{
s.transport( "UDP", (t)->{
t.socketBinding("jgroups-udp");
});
s.protocol("TCP", (p -> {
p.property("bind_port", "9090");
}));
s.protocol("TCPPING", (p)-> {
p.property("initial_hosts", "localhost[9090],localhost[9091],localhost[9092]")
.property("port_range", "3")
.property("timeout", "3000")
.property("num_initial_members", "3");
});
s.protocol( "FD_SOCK", (p)->{
p.socketBinding( "jgroups-udp-fd" );
});
s.protocol( "FD_ALL" );
s.protocol( "VERIFY_SUSPECT" );
s.protocol( "pbcast.NAKACK2" );
s.protocol( "UNICAST3" );
s.protocol( "pbcast.STABLE" );
s.protocol( "pbcast.GMS" );
s.protocol( "UFC" );
s.protocol( "MFC" );
s.protocol( "FRAG2" );
s.protocol( "RSVP" );
})
.channel( "swarm-jgroups", (c)->{
c.stack( "udp" );
});
;
container.fraction(fraction);

JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class);
deployment.addPackage( Main.class.getPackage() );
deployment.addAllDependencies();
Expand Down
Expand Up @@ -3,6 +3,7 @@
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.wildfly.swarm.container.Container;
import org.wildfly.swarm.jaxrs.JAXRSArchive;
import org.wildfly.swarm.jgroups.JGroupsFraction;
import org.wildfly.swarm.netflix.ribbon.RibbonArchive;

/**
Expand All @@ -12,6 +13,40 @@ public class Main {

public static void main(String[] args) throws Exception {
Container container = new Container();
JGroupsFraction fraction = new JGroupsFraction()
.defaultChannel( "swarm-jgroups")
.stack( "udp", (s)->{
s.transport( "UDP", (t)->{
t.socketBinding("jgroups-udp");
});
s.protocol("TCP", (p -> {
p.property("bind_port", "9090");
}));
s.protocol("TCPPING", (p)-> {
p.property("initial_hosts", "localhost[9090],localhost[9091],localhost[9092]")
.property("port_range", "3")
.property("timeout", "3000")
.property("num_initial_members", "3");
});
s.protocol( "FD_SOCK", (p)->{
p.socketBinding( "jgroups-udp-fd" );
});
s.protocol( "FD_ALL" );
s.protocol( "VERIFY_SUSPECT" );
s.protocol( "pbcast.NAKACK2" );
s.protocol( "UNICAST3" );
s.protocol( "pbcast.STABLE" );
s.protocol( "pbcast.GMS" );
s.protocol( "UFC" );
s.protocol( "MFC" );
s.protocol( "FRAG2" );
s.protocol( "RSVP" );
})
.channel( "swarm-jgroups", (c)->{
c.stack( "udp" );
});
;
container.fraction(fraction);
JAXRSArchive deployment = ShrinkWrap.create( JAXRSArchive.class );
deployment.addResource(TimeResource.class);
deployment.addAllDependencies();
Expand Down

0 comments on commit dcbc460

Please sign in to comment.