use of org.jgroups.tests.perf.PerfUtil.Config in project JGroups by belaban.
the class UPerf method init.
public void init(String props, String name, AddressGenerator generator, int bind_port, boolean use_fibers) throws Throwable {
thread_factory = new DefaultThreadFactory("invoker", false, true).useFibers(use_fibers);
if (use_fibers && Util.fibersAvailable())
System.out.println("-- using fibers instead of threads");
channel = new JChannel(props).addAddressGenerator(generator).setName(name);
if (bind_port > 0) {
TP transport = channel.getProtocolStack().getTransport();
transport.setBindPort(bind_port);
}
disp = new RpcDispatcher(channel, this).setReceiver(this).setMethodLookup(id -> METHODS[id]);
channel.connect(groupname);
local_addr = channel.getAddress();
try {
MBeanServer server = Util.getMBeanServer();
JmxConfigurator.registerChannel(channel, server, "jgroups", channel.getClusterName(), true);
} catch (Throwable ex) {
System.err.println("registering the channel in JMX failed: " + ex);
}
if (members.size() < 2)
return;
Address coord = members.get(0);
Config config = disp.callRemoteMethod(coord, new MethodCall(GET_CONFIG), new RequestOptions(ResponseMode.GET_ALL, 5000));
if (config != null) {
applyConfig(config);
System.out.println("Fetched config from " + coord + ": " + config + "\n");
} else
System.err.println("failed to fetch config from " + coord);
}
Aggregations