Commit 20c326f5 authored by Florian Fittkau's avatar Florian Fittkau

interface monitoring

parent 948d51bb
......@@ -49,7 +49,7 @@ public abstract class AbstractAspect {
AfterFailedOperationEventRecord.CLAZZ_ID,
AfterOperationEventRecord.COMPRESSED_BYTE_LENGTH_WITH_CLAZZ_ID,
AfterOperationEventRecord.CLAZZ_ID, System.identityHashCode(thisObject), thisObject
.getClass().getName());
.getClass().getName(), getInterface(thisJoinPoint));
}
@Around("monitoredOperation() && !this(java.lang.Object) && notWithinExplorViz()")
......@@ -61,7 +61,7 @@ public abstract class AbstractAspect {
AfterFailedStaticOperationEventRecord.CLAZZ_ID,
AfterStaticOperationEventRecord.COMPRESSED_BYTE_LENGTH_WITH_CLAZZ_ID,
AfterStaticOperationEventRecord.CLAZZ_ID, 0, thisJoinPoint.getSignature()
.getDeclaringTypeName());
.getDeclaringTypeName(), getInterface(thisJoinPoint));
}
@Around("monitoredConstructor() && this(thisObject) && notWithinExplorViz()")
......@@ -74,13 +74,24 @@ public abstract class AbstractAspect {
AfterFailedConstructorEventRecord.CLAZZ_ID,
AfterConstructorEventRecord.COMPRESSED_BYTE_LENGTH_WITH_CLAZZ_ID,
AfterConstructorEventRecord.CLAZZ_ID, System.identityHashCode(thisObject),
thisObject.getClass().getName());
thisObject.getClass().getName(), getInterface(thisJoinPoint));
}
private String getInterface(final ProceedingJoinPoint thisJoinPoint) {
@SuppressWarnings("rawtypes")
final Class[] interfaces = thisJoinPoint.getSignature().getDeclaringType().getInterfaces();
if (interfaces.length == 1) {
return interfaces[0].getName();
}
return "";
}
protected Object createEventRecords(final ProceedingJoinPoint thisJoinPoint,
final int beforeLength, final byte beforeId, final int afterFailedLength,
final byte afterFailedId, final int afterLength, final byte afterId,
final int objectId, final String clazz) throws Throwable {
final int objectId, final String clazz, final String implementedInterface)
throws Throwable {
if (!MonitoringController.isMonitoringEnabled()) {
return thisJoinPoint.proceed();
}
......@@ -107,6 +118,7 @@ public abstract class AbstractAspect {
}
buffer.putInt(MonitoringController.getIdForSignature(thisJoinPoint.getSignature()));
buffer.putInt(MonitoringStringRegistry.getIdForString(clazz));
buffer.putInt(MonitoringStringRegistry.getIdForString(implementedInterface));
final Object retval;
......@@ -128,6 +140,7 @@ public abstract class AbstractAspect {
if (newTrace) {
TraceRegistry.unregisterTrace();
}
throw th;
......
......@@ -16,11 +16,13 @@ public abstract class DistributedMonitoringAspect extends AbstractAspect {
protected Object createEventRecords(final ProceedingJoinPoint thisJoinPoint,
final int beforeLength, final byte beforeId, final int afterFailedLength,
final byte afterFailedId, final int afterLength, final byte afterId,
final int objectId, final String clazz) throws Throwable {
final int objectId, final String clazz, final String implementedInterface)
throws Throwable {
if (DistributedMonitoringTempDisabler.getProbeController().isMonitoringEnabled()
&& (thisJoinPoint.getStaticPart() != null)) {
return super.createEventRecords(thisJoinPoint, beforeLength, beforeId,
afterFailedLength, afterFailedId, afterLength, afterId, objectId, clazz);
afterFailedLength, afterFailedId, afterLength, afterId, objectId, clazz,
implementedInterface);
} else {
return thisJoinPoint.proceed();
}
......
package testpackage;
import explorviz.live_trace_processing.main.MonitoringController;
public class MonitoringAnonymousStarterTest {
public static void main(final String[] args) {
final MyTestThread myTestThread = new MyTestThread();
myTestThread.run();
try {
myTestThread.join();
} catch (final InterruptedException e) {
}
MonitoringController.shutdown();
}
}
package testpackage;
public class MyTestThread extends Thread {
public MyTestThread() {
super(new Runnable() {
@Override
public void run() {
// ...
}
});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment