Search in sources :

Example 1 with DiagnosticsHandler

use of org.jgroups.stack.DiagnosticsHandler in project JGroups by belaban.

the class ProgrammaticUPerf2 method init.

public void init(String name, String bind_addr, int bind_port) throws Exception {
    TP transport = channel.getProtocolStack().getTransport();
    disp.setServerObject(this);
    channel.setName(name);
    if (bind_port > 0)
        transport.setBindPort(bind_port);
    if (bind_addr != null)
        transport.setBindAddress(InetAddress.getByName(bind_addr));
    channel.connect(groupname);
    DiagnosticsHandler diag_handler = transport.getDiagnosticsHandler();
    if (diag_handler != null) {
        Set<DiagnosticsHandler.ProbeHandler> probe_handlers = diag_handler.getProbeHandlers();
        probe_handlers.removeIf(probe_handler -> {
            String[] keys = probe_handler.supportedKeys();
            return keys != null && Stream.of(keys).anyMatch(s -> s.startsWith("jmx"));
        });
    }
    transport.registerProbeHandler(h);
    local_addr = channel.getAddress();
    if (members.size() < 2)
        return;
    Address coord = members.get(0);
    Config config = disp.callRemoteMethod(coord, new CustomCall(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);
}
Also used : LongAdder(java.util.concurrent.atomic.LongAdder) java.util(java.util) Rsp(org.jgroups.util.Rsp) DiagnosticsHandler(org.jgroups.stack.DiagnosticsHandler) Util(org.jgroups.util.Util) RpcDispatcher(org.jgroups.blocks.RpcDispatcher) MethodCall(org.jgroups.blocks.MethodCall) InetAddress(java.net.InetAddress) AverageMinMax(org.jgroups.util.AverageMinMax) RequestOptions(org.jgroups.blocks.RequestOptions) NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) org.jgroups(org.jgroups) RspList(org.jgroups.util.RspList) PerfUtil(org.jgroups.tests.perf.PerfUtil) Property(org.jgroups.annotations.Property) Protocol(org.jgroups.stack.Protocol) ResponseMode(org.jgroups.blocks.ResponseMode) GMS(org.jgroups.protocols.pbcast.GMS) InetSocketAddress(java.net.InetSocketAddress) NonReflectiveProbeHandler(org.jgroups.stack.NonReflectiveProbeHandler) CountDownLatch(java.util.concurrent.CountDownLatch) Stream(java.util.stream.Stream) STABLE(org.jgroups.protocols.pbcast.STABLE) org.jgroups.protocols(org.jgroups.protocols) InetAddress(java.net.InetAddress) InetSocketAddress(java.net.InetSocketAddress) RequestOptions(org.jgroups.blocks.RequestOptions) NonReflectiveProbeHandler(org.jgroups.stack.NonReflectiveProbeHandler) DiagnosticsHandler(org.jgroups.stack.DiagnosticsHandler)

Aggregations

InetAddress (java.net.InetAddress)1 InetSocketAddress (java.net.InetSocketAddress)1 java.util (java.util)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 LongAdder (java.util.concurrent.atomic.LongAdder)1 Stream (java.util.stream.Stream)1 org.jgroups (org.jgroups)1 Property (org.jgroups.annotations.Property)1 MethodCall (org.jgroups.blocks.MethodCall)1 RequestOptions (org.jgroups.blocks.RequestOptions)1 ResponseMode (org.jgroups.blocks.ResponseMode)1 RpcDispatcher (org.jgroups.blocks.RpcDispatcher)1 org.jgroups.protocols (org.jgroups.protocols)1 GMS (org.jgroups.protocols.pbcast.GMS)1 NAKACK2 (org.jgroups.protocols.pbcast.NAKACK2)1 STABLE (org.jgroups.protocols.pbcast.STABLE)1 DiagnosticsHandler (org.jgroups.stack.DiagnosticsHandler)1 NonReflectiveProbeHandler (org.jgroups.stack.NonReflectiveProbeHandler)1 Protocol (org.jgroups.stack.Protocol)1