@Test @AgentAttachmentRule.Enforce public void FileSystemTracer_should_attach_to_delete_DistributedFileSystem() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, IOException, ClassNotFoundException { Path toDelete = new Path("/test/to_delete"); createSrcPathDistributedFilesystem(toDelete); Method delete = clazzFS.getMethod("delete", Path.class, boolean.class); delete.invoke(dfs, toDelete, true); checkEvent(FsAction.DELETE.name(), toDelete); }
public static Method getMethod(ClassLoader classLoader, String clazz, String method, Class<?>... parameterTypes) { return (Method) getMethodCache().computeIfAbsent(classLoader + clazz + method, k -> { try { Class classzz = classLoader.loadClass(clazz); return classzz.getMethod(method, parameterTypes); } catch (NoSuchMethodException | ClassNotFoundException ignored) { return null; } }); }
FileSystemTracer { public static Method getMethod(ClassLoader classLoader, String clazz, String method, Class<?>... parameterTypes) { return (Method) getMethodCache().computeIfAbsent(classLoader + clazz + method, k -> { try { Class classzz = classLoader.loadClass(clazz); return classzz.getMethod(method, parameterTypes); } catch (NoSuchMethodException | ClassNotFoundException ignored) { return null; } }); } }
FileSystemTracer { public static Method getMethod(ClassLoader classLoader, String clazz, String method, Class<?>... parameterTypes) { return (Method) getMethodCache().computeIfAbsent(classLoader + clazz + method, k -> { try { Class classzz = classLoader.loadClass(clazz); return classzz.getMethod(method, parameterTypes); } catch (NoSuchMethodException | ClassNotFoundException ignored) { return null; } }); } protected  FileSystemTracer(); }
FileSystemTracer { public static Method getMethod(ClassLoader classLoader, String clazz, String method, Class<?>... parameterTypes) { return (Method) getMethodCache().computeIfAbsent(classLoader + clazz + method, k -> { try { Class classzz = classLoader.loadClass(clazz); return classzz.getMethod(method, parameterTypes); } catch (NoSuchMethodException | ClassNotFoundException ignored) { return null; } }); } protected  FileSystemTracer(); static void setup(Instrumentation instrumentation, BiConsumer<Long, Object> eventConsumer); static ConcurrentHashMap getFieldCache(); static ConcurrentHashMap getMethodCache(); static Method getMethod(ClassLoader classLoader, String clazz, String method, Class<?>... parameterTypes); static Field getField(ClassLoader classLoader, String clazz, String field); static void initEventHandler(BiConsumer<Long, Object> eventConsumer); }
FileSystemTracer { public static Method getMethod(ClassLoader classLoader, String clazz, String method, Class<?>... parameterTypes) { return (Method) getMethodCache().computeIfAbsent(classLoader + clazz + method, k -> { try { Class classzz = classLoader.loadClass(clazz); return classzz.getMethod(method, parameterTypes); } catch (NoSuchMethodException | ClassNotFoundException ignored) { return null; } }); } protected  FileSystemTracer(); static void setup(Instrumentation instrumentation, BiConsumer<Long, Object> eventConsumer); static ConcurrentHashMap getFieldCache(); static ConcurrentHashMap getMethodCache(); static Method getMethod(ClassLoader classLoader, String clazz, String method, Class<?>... parameterTypes); static Field getField(ClassLoader classLoader, String clazz, String field); static void initEventHandler(BiConsumer<Long, Object> eventConsumer);  }