use of org.jgroups.protocols.TCP in project fabric8 by jboss-fuse.
the class TestBase method setUp.
@Before
public void setUp() throws Exception {
for (int i = 0; i < NUM; i++) {
Protocol ping = createPing();
channels[i] = new JChannel(new TCP(), ping, new NAKACK2(), new UNICAST3(), new STABLE(), new GMS());
channels[i].setName(Character.toString((char) ('A' + i)));
channels[i].connect(CLUSTER_NAME);
channels[i].setReceiver(receivers[i] = new MyReceiver());
}
}
use of org.jgroups.protocols.TCP in project JGroups by belaban.
the class NAKACK2 method init.
public void init() throws Exception {
if (xmit_from_random_member && discard_delivered_msgs) {
discard_delivered_msgs = false;
log.debug("%s: xmit_from_random_member set to true: changed discard_delivered_msgs to false", local_addr);
}
TP transport = getTransport();
// UDP and TCP_NIO2 won't block
sends_can_block = transport instanceof TCP;
transport.registerProbeHandler(this);
if (!transport.supportsMulticasting()) {
if (use_mcast_xmit) {
log.debug(Util.getMessage("NoMulticastTransport"), "use_mcast_xmit", transport.getName(), "use_mcast_xmit");
use_mcast_xmit = false;
}
if (use_mcast_xmit_req) {
log.debug(Util.getMessage("NoMulticastTransport"), "use_mcast_xmit_req", transport.getName(), "use_mcast_xmit_req");
use_mcast_xmit_req = false;
}
}
if (become_server_queue_size > 0)
become_server_queue = new BoundedList<>(become_server_queue_size);
if (suppress_time_non_member_warnings > 0)
suppress_log_non_member = new SuppressLog<>(log, "MsgDroppedNak", "SuppressMsg");
// max bundle size (minus overhead) divided by <long size> times bits per long
int estimated_max_msgs_in_xmit_req = (transport.getBundler().getMaxSize() - 50) * Global.LONG_SIZE;
int old_max_xmit_size = max_xmit_req_size;
if (max_xmit_req_size <= 0)
max_xmit_req_size = estimated_max_msgs_in_xmit_req;
else
max_xmit_req_size = Math.min(max_xmit_req_size, estimated_max_msgs_in_xmit_req);
if (old_max_xmit_size != max_xmit_req_size)
log.trace("%s: set max_xmit_req_size from %d to %d", local_addr, old_max_xmit_size, max_xmit_req_size);
if (resend_last_seqno)
setResendLastSeqno(resend_last_seqno);
}
use of org.jgroups.protocols.TCP 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