Search in sources :

Example 1 with ProbeClientInvoker

use of org.glassfish.flashlight.client.ProbeClientInvoker in project Payara by payara.

the class FlashlightProbeClientMediator method registerJavaListener.

private void registerJavaListener(Object listener, List<ProbeClientMethodHandle> pcms, List<FlashlightProbe> probesRequiringClassTransformation, String invokerId) {
    List<MethodProbe> methodProbePairs = handleListenerAnnotations(listener.getClass(), invokerId);
    if (methodProbePairs.isEmpty()) {
        return;
    }
    for (MethodProbe mp : methodProbePairs) {
        FlashlightProbe probe = mp.probe;
        ProbeClientInvoker invoker = ProbeClientInvokerFactory.createInvoker(listener, mp.method, probe);
        ProbeClientMethodHandleImpl hi = new ProbeClientMethodHandleImpl(invoker.getId(), invoker, probe);
        pcms.add(hi);
        if (probe.addInvoker(invoker))
            probesRequiringClassTransformation.add(probe);
    }
}
Also used : FlashlightProbe(org.glassfish.flashlight.provider.FlashlightProbe) ProbeClientInvoker(org.glassfish.flashlight.client.ProbeClientInvoker)

Example 2 with ProbeClientInvoker

use of org.glassfish.flashlight.client.ProbeClientInvoker in project Payara by payara.

the class FlashlightProbeClientMediator method registerDTraceListener.

private Object registerDTraceListener(FlashlightProbeProvider propro, List<ProbeClientMethodHandle> pcms, List<FlashlightProbe> probesRequiringClassTransformation) {
    // The "listener" needs to be registered against every Probe in propro...
    Collection<FlashlightProbe> probes = propro.getProbes();
    Object listener = null;
    for (FlashlightProbe probe : probes) {
        ProbeClientInvoker invoker = ProbeClientInvokerFactory.createDTraceInvoker(probe);
        ProbeClientMethodHandleImpl hi = new ProbeClientMethodHandleImpl(invoker.getId(), invoker, probe);
        pcms.add(hi);
        if (probe.addInvoker(invoker))
            probesRequiringClassTransformation.add(probe);
        if (listener == null)
            // all the probes in propro have the same "listener"
            listener = probe.getDTraceProviderImpl();
    }
    return listener;
}
Also used : FlashlightProbe(org.glassfish.flashlight.provider.FlashlightProbe) ProbeClientInvoker(org.glassfish.flashlight.client.ProbeClientInvoker)

Example 3 with ProbeClientInvoker

use of org.glassfish.flashlight.client.ProbeClientInvoker in project Payara by payara.

the class FlashlightProbe method initInvokerList.

private void initInvokerList() {
    Set<Map.Entry<Integer, ProbeClientInvoker>> entries = invokers.entrySet();
    List<ProbeClientInvoker> invList = new ArrayList(2);
    if (stateful) {
        // invokes
        for (Map.Entry<Integer, ProbeClientInvoker> entry : entries) {
            ProbeClientInvoker invoker = entry.getValue();
            if (invoker instanceof StatefulProbeClientInvoker)
                invList.add(invoker);
        }
    } else {
        for (Map.Entry<Integer, ProbeClientInvoker> entry : entries) {
            ProbeClientInvoker invoker = entry.getValue();
            invList.add(invoker);
        }
    }
    invokerList = invList;
}
Also used : ProbeClientInvoker(org.glassfish.flashlight.client.ProbeClientInvoker) StatefulProbeClientInvoker(org.glassfish.flashlight.client.StatefulProbeClientInvoker) ArrayList(java.util.ArrayList) StatefulProbeClientInvoker(org.glassfish.flashlight.client.StatefulProbeClientInvoker) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ConcurrentMap(java.util.concurrent.ConcurrentMap)

Example 4 with ProbeClientInvoker

use of org.glassfish.flashlight.client.ProbeClientInvoker in project Payara by payara.

the class FlashlightProbe method removeInvoker.

public synchronized boolean removeInvoker(ProbeClientInvoker invoker) {
    ProbeClientInvoker pci = invokers.remove(invoker.getId());
    if (pci != null) {
        if (logger.isLoggable(Level.FINE))
            logger.fine("Removing an invoker that already exists: " + pci.getId() + "  ##########");
    } else {
        if (logger.isLoggable(Level.FINE))
            logger.fine("Failed to remove an invoker that does not exist: " + invoker.getId() + "  %%%%%%%%%");
    }
    if (logger.isLoggable(Level.FINE)) {
        logger.fine("Total invokers = " + invokers.size());
    }
    listenerEnabled.set(!invokers.isEmpty());
    initInvokerList();
    return listenerEnabled.get();
}
Also used : ProbeClientInvoker(org.glassfish.flashlight.client.ProbeClientInvoker) StatefulProbeClientInvoker(org.glassfish.flashlight.client.StatefulProbeClientInvoker)

Aggregations

ProbeClientInvoker (org.glassfish.flashlight.client.ProbeClientInvoker)4 StatefulProbeClientInvoker (org.glassfish.flashlight.client.StatefulProbeClientInvoker)2 FlashlightProbe (org.glassfish.flashlight.provider.FlashlightProbe)2 ArrayList (java.util.ArrayList)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1