use of org.jgroups.stack.Protocol in project hibernate-orm by hibernate.
the class TestDisconnectHandler method getFD.
private Protocol getFD() {
Protocol protocol = getProtocolStack().findProtocol(FD_ALL.class, FD_ALL2.class, FD_SOCK.class, FD_HOST.class);
log.trace("Found protocol " + protocol);
return protocol;
}
use of org.jgroups.stack.Protocol in project hibernate-orm by hibernate.
the class TestDisconnectHandler method down.
@Override
public Object down(Event evt) {
switch(evt.getType()) {
case Event.SET_LOCAL_ADDRESS:
localAddress = (Address) evt.getArg();
log.trace("Set address " + localAddress);
break;
case Event.CONNECT:
case Event.CONNECT_WITH_STATE_TRANSFER:
case Event.CONNECT_USE_FLUSH:
case Event.CONNECT_WITH_STATE_TRANSFER_USE_FLUSH:
log.trace("Connecting on " + localAddress);
// we need to pass the message from below GMS (let's say regular FD* protocols
connected.add(getFD());
break;
case Event.DISCONNECT:
log.trace("Disconnecting on " + localAddress);
connected.remove(getFD());
// reduce view ack collection timeout to minimum, since we don't want to wait anymore
GMS gms = (GMS) getProtocolStack().findProtocol(GMS.class);
gms.setViewAckCollectionTimeout(1);
for (Protocol other : connected) {
executor.execute(() -> {
log.trace("Suspecting " + localAddress + " on " + other);
Event suspectEvent = new Event(Event.SUSPECT, localAddress);
other.up(suspectEvent);
other.down(suspectEvent);
});
}
break;
}
return super.down(evt);
}
use of org.jgroups.stack.Protocol in project JGroups by belaban.
the class LockServiceTest method setProp.
protected void setProp(Class<? extends Protocol> clazz, String prop_name, Object value, JChannel... channels) {
for (JChannel ch : channels) {
Protocol prot = ch.getProtocolStack().findProtocol(clazz);
prot.setValue(prop_name, value);
}
}
use of org.jgroups.stack.Protocol in project JGroups by belaban.
the class SASLTest method createChannel.
private static JChannel createChannel(String channelName, String mech, String username) throws Exception {
SASL sasl = new SASL();
sasl.setMech(mech);
sasl.setClientCallbackHandler(new MyCallbackHandler(username));
sasl.setServerCallbackHandler(new MyCallbackHandler(username));
sasl.setTimeout(5000);
if (System.getProperty("java.vendor").contains("IBM")) {
sasl.sasl_props.put("com.ibm.security.sasl.digest.realm", REALM);
} else {
sasl.sasl_props.put("com.sun.security.sasl.digest.realm", REALM);
}
sasl.setLevel("trace");
GMS gms = new GMS();
gms.setJoinTimeout(3000);
return new JChannel(new Protocol[] { new SHARED_LOOPBACK(), new PING(), new MERGE3(), new NAKACK2(), new UNICAST3(), new STABLE(), sasl, gms }).name(channelName);
}
use of org.jgroups.stack.Protocol in project JGroups by belaban.
the class SASL_SimpleAuthorizingCallbackTest method createChannel.
private JChannel createChannel(String channelName, String mech, String principal) throws Exception {
Properties properties = new Properties();
properties.put("sasl.local.principal", principal);
properties.put("sasl.credentials.properties", credentialsFile.getAbsolutePath());
properties.put("sasl.role", "mycluster");
properties.put("sasl.roles.properties", rolesFile.getAbsolutePath());
properties.put("sasl.realm", REALM);
SASL sasl = new SASL();
sasl.setMech(mech);
sasl.setClientCallbackHandler(new SimpleAuthorizingCallbackHandler(properties));
sasl.setServerCallbackHandler(new SimpleAuthorizingCallbackHandler(properties));
sasl.setTimeout(5000);
if (System.getProperty("java.vendor").contains("IBM")) {
sasl.sasl_props.put("com.ibm.security.sasl.digest.realm", REALM);
} else {
sasl.sasl_props.put("com.sun.security.sasl.digest.realm", REALM);
}
return new JChannel(new Protocol[] { new SHARED_LOOPBACK(), new PING(), new NAKACK2(), new UNICAST3(), new STABLE(), sasl, new GMS() }).name(channelName);
}
Aggregations