use of org.jgroups.stack.Protocol in project JGroups by belaban.
the class RemoteGetStressTest method createChannel.
protected static JChannel createChannel(String name) throws Exception {
SHARED_LOOPBACK sl = new SHARED_LOOPBACK();
sl.getThreadPool().setMinThreads(1).setMaxThreads(5);
Protocol[] protocols = { sl, new SHARED_LOOPBACK_PING(), new NAKACK2(), new UNICAST3(), new STABLE(), new GMS(), new UFC(), new MFC().setMaxCredits(2000000).setMinThreshold(0.4), new FRAG2().setFragSize(8000) };
return new JChannel(protocols).name(name);
}
use of org.jgroups.stack.Protocol in project JGroups by belaban.
the class StateTransferTest method replaceStateTransferProtocolWith.
protected static void replaceStateTransferProtocolWith(JChannel ch, Class<? extends Protocol> state_transfer_class) throws Exception {
ProtocolStack stack = ch.getProtocolStack();
if (stack.findProtocol(state_transfer_class) != null)
// protocol of the right class is already in stack
return;
Protocol prot = stack.findProtocol(STATE_TRANSFER.class, StreamingStateTransfer.class);
Protocol new_state_transfer_protcol = state_transfer_class.getDeclaredConstructor().newInstance();
if (prot != null) {
stack.replaceProtocol(prot, new_state_transfer_protcol);
} else {
// no state transfer protocol found in stack
Protocol flush = stack.findProtocol(FLUSH.class);
if (flush != null)
stack.insertProtocol(new_state_transfer_protcol, ProtocolStack.Position.BELOW, FLUSH.class);
else
stack.insertProtocolAtTop(new_state_transfer_protcol);
}
}
use of org.jgroups.stack.Protocol in project JGroups by belaban.
the class SHUFFLE method down.
public Object down(Message msg) {
Protocol dn_prot = down_prot;
if (dn_prot == null)
return null;
if (!down)
return dn_prot.down(msg);
add(down_msgs, msg, down_lock, dn_prot::down);
return null;
}
use of org.jgroups.stack.Protocol in project JGroups by belaban.
the class SHUFFLE method up.
public Object up(Message msg) {
Protocol up_protocol = up_prot;
if (up_protocol == null)
return null;
if (!up)
return up_protocol.up(msg);
add(up_msgs, msg, up_lock, m -> up_protocol.up(msg));
return null;
}
use of org.jgroups.stack.Protocol in project JGroups by belaban.
the class Relay2Test method testAddRelay2ToAnAlreadyConnectedChannel.
/**
* Test that RELAY2 can be added to an already connected channel.
*/
public void testAddRelay2ToAnAlreadyConnectedChannel() throws Exception {
// Create and connect a channel.
a = new JChannel();
a.connect(SFO_CLUSTER);
System.out.println("Channel " + a.getName() + " is connected. View: " + a.getView());
// Add RELAY2 protocol to the already connected channel.
RELAY2 relayToInject = createRELAY2(SFO);
// Util.setField(Util.getField(relayToInject.getClass(), "local_addr"), relayToInject, a.getAddress());
a.getProtocolStack().insertProtocolAtTop(relayToInject);
for (Protocol p = relayToInject; p != null; p = p.getDownProtocol()) p.setAddress(a.getAddress());
relayToInject.setProtocolStack(a.getProtocolStack());
relayToInject.configure();
relayToInject.handleView(a.getView());
// Check for RELAY2 presence
RELAY2 ar = a.getProtocolStack().findProtocol(RELAY2.class);
assert ar != null;
waitUntilRoute(SFO, true, 10000, 500, a);
assert !ar.printRoutes().equals("n/a (not site master)") : "This member should be site master";
Route route = getRoute(a, SFO);
System.out.println("Route at sfo to sfo: " + route);
assert route != null;
}
Aggregations