use of org.jgroups.JChannel in project activemq-artemis by apache.
the class ActiveMQResourceAdapter method createBroadcastEndpointFactory.
protected BroadcastEndpointFactory createBroadcastEndpointFactory(final ConnectionFactoryProperties overrideProperties) {
String discoveryAddress = overrideProperties.getDiscoveryAddress() != null ? overrideProperties.getDiscoveryAddress() : getDiscoveryAddress();
if (discoveryAddress != null) {
Integer discoveryPort = overrideProperties.getDiscoveryPort() != null ? overrideProperties.getDiscoveryPort() : getDiscoveryPort();
if (discoveryPort == null) {
discoveryPort = ActiveMQClient.DEFAULT_DISCOVERY_PORT;
}
String localBindAddress = overrideProperties.getDiscoveryLocalBindAddress() != null ? overrideProperties.getDiscoveryLocalBindAddress() : raProperties.getDiscoveryLocalBindAddress();
return new UDPBroadcastEndpointFactory().setGroupAddress(discoveryAddress).setGroupPort(discoveryPort).setLocalBindAddress(localBindAddress).setLocalBindPort(-1);
}
String jgroupsChannel = overrideProperties.getJgroupsChannelName() != null ? overrideProperties.getJgroupsChannelName() : getJgroupsChannelName();
String jgroupsLocatorClassName = raProperties.getJgroupsChannelLocatorClass();
if (jgroupsLocatorClassName != null) {
String jchannelRefName = raProperties.getJgroupsChannelRefName();
JChannel jchannel = ActiveMQRaUtils.locateJGroupsChannel(jgroupsLocatorClassName, jchannelRefName);
return new ChannelBroadcastEndpointFactory(jchannel, jgroupsChannel);
}
String jgroupsFileName = overrideProperties.getJgroupsFile() != null ? overrideProperties.getJgroupsFile() : getJgroupsFile();
if (jgroupsFileName != null) {
return new JGroupsFileBroadcastEndpointFactory().setChannelName(jgroupsChannel).setFile(jgroupsFileName);
}
return null;
}
use of org.jgroups.JChannel in project wildfly by wildfly.
the class ChannelServiceConfigurator method get.
@Override
public JChannel get() {
try {
JChannel channel = this.factory.get().createChannel(this.name);
if (JGroupsLogger.ROOT_LOGGER.isTraceEnabled()) {
JGroupsLogger.ROOT_LOGGER.tracef("JGroups channel %s created with configuration:%n %s", this.name, channel.getProtocolStack().printProtocolSpec(true));
}
channel.stats(this.statisticsEnabled);
if (this.server != null) {
try {
JmxConfigurator.registerChannel(channel, this.server.get(), this.name);
} catch (Exception e) {
JGroupsLogger.ROOT_LOGGER.debug(e.getLocalizedMessage(), e);
}
}
channel.connect(this.cluster.get());
return channel;
} catch (Exception e) {
throw new IllegalStateException(e);
}
}
use of org.jgroups.JChannel in project cayenne by apache.
the class JavaGroupsBridge method startupExternal.
@Override
protected void startupExternal() throws Exception {
// set of properties, trying to configure multicast address and port
if (configURL != null) {
channel = new JChannel(configURL);
} else {
String configString = buildConfigString();
channel = new JChannel(configString);
}
// Important - discard messages from self
channel.setOpt(Channel.LOCAL, Boolean.FALSE);
channel.connect(externalSubject);
if (receivesExternalEvents()) {
adapter = new PullPushAdapter(channel, this);
}
}
use of org.jgroups.JChannel in project JGroups by belaban.
the class CounterServiceDemo method start.
void start(String props, String channel_name) throws Exception {
ch = new JChannel(props);
ch.setName(channel_name);
ch.setReceiver(new Receiver() {
public void viewAccepted(View view) {
System.out.println("-- view: " + view);
}
});
loop();
}
use of org.jgroups.JChannel in project JGroups by belaban.
the class LockServiceDemo method start.
public void start() throws Exception {
try {
ch = new JChannel(props);
if (name != null)
ch.setName(name);
lock_service = new LockService(ch);
lock_service.addLockListener(this);
ch.connect("lock-cluster");
JmxConfigurator.registerChannel(ch, Util.getMBeanServer(), "lock-service", ch.getClusterName(), true);
loop();
} catch (Exception e) {
e.printStackTrace();
} finally {
Util.close(ch);
}
}
Aggregations