Exemple #1
0
 private void transform(Pattern pattern, List<Class<?>> classes, File dir) {
   ClassDumpTransformer transformer = new ClassDumpTransformer(pattern, dir);
   instrumentation.addTransformer(transformer, true);
   try {
     for (Class<?> clazz : classes) {
       try {
         instrumentation.retransformClasses(clazz);
       } catch (UnmodifiableClassException e) {
         log.log(Level.WARNING, "Unexpected error", e);
       }
     }
   } finally {
     instrumentation.removeTransformer(transformer);
   }
 }
Exemple #2
0
 @Override
 public void shutDown() {
   if (initialized.compareAndSet(true, false)) {
     stop();
     configuration.removeChangeListener(this);
     instrumentation.removeTransformer(this);
     Thread t = transformThread;
     transformThread = null;
     if (t != null && !t.isInterrupted()) {
       t.interrupt();
     }
     cleanUp.set(true);
     try {
       // clean up
       instrumentApplication();
     } catch (Throwable e) {
       LOG.error("Failed to shutdown", e);
     }
   }
 }