Search in sources :

Example 1 with StatefulProbeClientInvoker

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

the class FlashlightProbe method fireProbeOnException.

public void fireProbeOnException(Object exceptionValue, ArrayList<ProbeInvokeState> states) {
    if (!listenerEnabled.get()) {
        return;
    }
    if (parent != null) {
        parent.fireProbeOnException(exceptionValue, states);
    }
    int sz = invokerList.size();
    int stateIndex = -1;
    for (int i = 0; i < sz; i++) {
        StatefulProbeClientInvoker invoker = (StatefulProbeClientInvoker) invokerList.get(i);
        if (invoker != null) {
            stateIndex = findStateIndex(invoker.getId(), states);
            if (stateIndex >= 0)
                invoker.invokeOnException(states.get(stateIndex).getState(), exceptionValue);
        }
    }
}
Also used : StatefulProbeClientInvoker(org.glassfish.flashlight.client.StatefulProbeClientInvoker)

Example 2 with StatefulProbeClientInvoker

use of org.glassfish.flashlight.client.StatefulProbeClientInvoker 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 3 with StatefulProbeClientInvoker

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

the class FlashlightProbe method fireProbeAfter.

public void fireProbeAfter(Object returnValue, ArrayList<ProbeInvokeState> states) {
    if (!listenerEnabled.get()) {
        return;
    }
    if (parent != null) {
        parent.fireProbeAfter(returnValue, states);
    }
    int sz = invokerList.size();
    int stateIndex = -1;
    for (int i = 0; i < sz; i++) {
        StatefulProbeClientInvoker invoker = (StatefulProbeClientInvoker) invokerList.get(i);
        if (invoker != null) {
            stateIndex = findStateIndex(invoker.getId(), states);
            if (stateIndex >= 0)
                invoker.invokeAfter(states.get(stateIndex).getState(), returnValue);
        }
    }
}
Also used : StatefulProbeClientInvoker(org.glassfish.flashlight.client.StatefulProbeClientInvoker)

Example 4 with StatefulProbeClientInvoker

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

the class FlashlightProbe method fireProbeBefore.

public ArrayList<ProbeInvokeState> fireProbeBefore(Object[] params) {
    if (!listenerEnabled.get()) {
        return null;
    }
    ArrayList<ProbeInvokeState> probeInvokeStates = new ArrayList<ProbeInvokeState>();
    if (parent != null) {
        ArrayList<ProbeInvokeState> parentStates = parent.fireProbeBefore(params);
        probeInvokeStates.addAll(parentStates);
    }
    int sz = invokerList.size();
    for (int i = 0; i < sz; i++) {
        StatefulProbeClientInvoker invoker = (StatefulProbeClientInvoker) invokerList.get(i);
        if (invoker != null) {
            probeInvokeStates.add(new ProbeInvokeState(invoker.getId(), invoker.invokeBefore(params)));
        }
    }
    return probeInvokeStates;
}
Also used : ArrayList(java.util.ArrayList) StatefulProbeClientInvoker(org.glassfish.flashlight.client.StatefulProbeClientInvoker)

Aggregations

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