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);
}
}
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;
}
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;
}
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();
}
Aggregations