use of org.jgroups.protocols.UNICAST3 in project geode by apache.
the class InterceptUDP method handleMessage.
private void handleMessage(Message msg) {
if (collectMessages) {
collectedMessages.add(msg);
}
Object o = msg.getHeader(nakackHeaderId);
if (o != null) {
mcastSentDataMessages++;
} else {
o = msg.getHeader(unicastHeaderId);
if (o != null) {
UNICAST3.Header hdr = (UNICAST3.Header) o;
switch(hdr.type()) {
case UNICAST3.Header.DATA:
unicastSentDataMessages++;
Message response = new Message(uuid, msg.getDest(), null);
response.putHeader(unicastHeaderId, UNICAST3.Header.createAckHeader(hdr.seqno(), hdr.connId(), System.currentTimeMillis()));
up_prot.up(new Event(Event.MSG, response));
break;
}
}
}
}
use of org.jgroups.protocols.UNICAST3 in project JGroups by belaban.
the class MergeTest2 method createChannel.
protected JChannel createChannel(String name) throws Exception {
SHARED_LOOPBACK shared_loopback = new SHARED_LOOPBACK();
shared_loopback.setDiagnosticsHandler(handler);
JChannel retval = new JChannel(shared_loopback, new DISCARD().setValue("discard_all", true), new SHARED_LOOPBACK_PING(), new NAKACK2().setValue("use_mcast_xmit", false).setValue("log_discard_msgs", false).setValue("log_not_found_msgs", false), new UNICAST3(), new STABLE().setValue("max_bytes", 50000), new GMS().setValue("print_local_addr", false).setValue("leave_timeout", 100).setValue("merge_timeout", 3000).setValue("log_view_warnings", false).setValue("view_ack_collection_timeout", 50).setValue("log_collect_msgs", false));
retval.setName(name);
JmxConfigurator.registerChannel(retval, Util.getMBeanServer(), name, retval.getClusterName(), true);
retval.connect("MergeTest2");
return retval;
}
use of org.jgroups.protocols.UNICAST3 in project JGroups by belaban.
the class RpcDispatcherAsyncInvocationTest method createChannel.
protected static JChannel createChannel(String name) throws Exception {
SHARED_LOOPBACK sl = new SHARED_LOOPBACK();
sl.getThreadPool().setMinThreads(10).setMaxThreads(20);
return new JChannel(sl, new SHARED_LOOPBACK_PING(), new NAKACK2(), new UNICAST3(), new GMS()).name(name);
}
use of org.jgroups.protocols.UNICAST3 in project JGroups by belaban.
the class TUNNELDeadLockTest method createTunnelChannel.
protected JChannel createTunnelChannel(String name) throws Exception {
TUNNEL tunnel = new TUNNEL().setBindAddress(InetAddress.getByName(bind_addr));
tunnel.setGossipRouterHosts(gossip_router_hosts);
JChannel ch = new JChannel(tunnel, new PING(), new NAKACK2(), new UNICAST3(), new STABLE(), new GMS().setJoinTimeout(1000)).name(name);
if (name != null)
ch.setName(name);
return ch;
}
use of org.jgroups.protocols.UNICAST3 in project JGroups by belaban.
the class DNSDiscoveryTester method runTestAndCheckIfViewWasReceived.
public boolean runTestAndCheckIfViewWasReceived(String dnsQuery, String recordType) throws Exception {
List<JChannel> channels = new ArrayList<>();
CountDownLatch waitForViewToForm = new CountDownLatch(1);
for (int i = 0; i < numberOfTestedInstances; ++i) {
DNS_PING ping = new DNS_PING();
ping.dns_resolver = dnsResolverBuilder.build();
ping.dns_query = dnsQuery;
ping.dns_record_type = recordType;
ping.dns_address = "fake.com";
Protocol[] protocols = { new TCP().setBindAddress(InetAddress.getLoopbackAddress()).setBindPort(portStart).setPortRange(1), ping, new NAKACK2(), new UNICAST3(), new STABLE(), new GMS().setJoinTimeout(timeout) };
JChannel c = new JChannel(protocols).name(String.valueOf(i + 1));
channels.add(c);
c.setReceiver(new Receiver() {
@Override
public void viewAccepted(View view) {
if (view.getMembers().size() == numberOfTestedInstances) {
waitForViewToForm.countDown();
}
}
});
c.connect("TEST");
}
boolean viewReceived = waitForViewToForm.await(timeout, unit);
channels.forEach(JChannel::close);
return viewReceived;
}
Aggregations