publicstaticvoid run() { // Semaphores to let each thread know where the other is. We could use barriers but semaphores // mean we don't need to have the worker thread be waiting around. final Semaphore sem_redefine_start = new Semaphore(0); final Semaphore sem_redefine_end = new Semaphore(0); // Create a thread to do the actual redefinition. We will just communicate through an // atomic-integer. newThread(() -> { try { // Wait for the other thread to ask for redefinition.
sem_redefine_start.acquire(); // Do the redefinition.
Redefinition.doCommonClassRedefinition(Transform.class, CLASS_BYTES, DEX_BYTES); // Allow the other thread to wake up if it is waiting.
sem_redefine_end.release();
} catch (InterruptedException e) { thrownew Error("unable to do redefinition", e);
}
}).start();
Transform t = new Transform();
t.sayHi(() -> { System.out.println("Not doing anything here"); });
t.sayHi(() -> { try {
System.out.println("transforming calling function"); // Wake up the waiting thread.
sem_redefine_start.release(); // Wait for the other thread to finish with redefinition.
sem_redefine_end.acquire();
} catch (InterruptedException e) { thrownew Error("unable to do redefinition", e);
}
});
t.sayHi(() -> { System.out.println("Not doing anything here"); });
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.