|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jikesrvm.Callbacks
public final class Callbacks
A class for managing various callbacks from the VM.
Consumers should register an implementation of the needed interface with a given callback method, and will get notified when the event happens.
Note: callback consumers should not rely on any particular order of callback invocation.
TODO: allow limited control over callback order.
The following events are currently implemented. See code for exact invocation syntax.
Nested Class Summary | |
---|---|
static interface |
Callbacks.AppCompleteMonitor
Interface for monitoring when an application completes executing |
static interface |
Callbacks.AppRunCompleteMonitor
Interface for monitoring when an application completes a run |
static interface |
Callbacks.AppRunStartMonitor
Interface for monitoring when an application starts a run |
static interface |
Callbacks.AppStartMonitor
Interface for monitoring when an application starts executing |
static interface |
Callbacks.BootImageMonitor
Interface for monitoring boot image writing. |
private static class |
Callbacks.CallbackList
Linked list of callbacks. |
static interface |
Callbacks.ClassInitializedMonitor
Interface for monitoring class initialization. |
static interface |
Callbacks.ClassInstantiatedMonitor
Interface for monitoring class instantiation. |
static interface |
Callbacks.ClassLoadedMonitor
Interface for monitoring class loading. |
static interface |
Callbacks.ClassResolvedMonitor
Interface for monitoring class resolution. |
static interface |
Callbacks.DefineClassMonitor
Interface for monitoring defineClass calls. |
static interface |
Callbacks.ExitMonitor
Interface for monitoring VM exit. |
static interface |
Callbacks.ForNameMonitor
Interface for monitoring forName calls. |
static interface |
Callbacks.LoadClassMonitor
Interface for monitoring loadClass calls. |
static interface |
Callbacks.MethodCompileMonitor
Interface for monitoring method compile. |
static interface |
Callbacks.MethodOverrideMonitor
Interface for monitoring method override. |
static interface |
Callbacks.RecompileAllDynamicallyLoadedMethodsMonitor
Interface for requesting VM to recompile all previously dynamically compiled methods |
static interface |
Callbacks.StartupMonitor
Interface for monitoring VM startup. |
Field Summary | |
---|---|
private static Callbacks.CallbackList |
appCompleteCallbacks
Application Execution Complete callback list. |
private static Object |
appCompleteLock
|
private static Callbacks.CallbackList |
appRunCompleteCallbacks
Application Run Complete callback list. |
private static Object |
appRunCompleteLock
|
private static Callbacks.CallbackList |
appRunStartCallbacks
Application Run Start callback list. |
private static Object |
appRunStartLock
|
private static Callbacks.CallbackList |
appStartCallbacks
Application Start executing callback list. |
private static Object |
appStartLock
|
private static Callbacks.CallbackList |
bootImageCallbacks
Boot image writing callback list. |
private static boolean |
bootImageEnabled
|
private static Object |
bootImageLock
|
private static Callbacks.CallbackList |
classInitializedCallbacks
Class initialization callback list. |
private static boolean |
classInitializedEnabled
|
private static Object |
classInitializedLock
|
private static Callbacks.CallbackList |
classInstantiatedCallbacks
Class instantiation callback list. |
private static boolean |
classInstantiatedEnabled
|
private static Object |
classInstantiatedLock
|
private static Callbacks.CallbackList |
classLoadedCallbacks
Class loading callback list. |
private static boolean |
classLoadedEnabled
|
private static Object |
classLoadedLock
|
private static Callbacks.CallbackList |
classResolvedCallbacks
Class resolution callback list. |
private static boolean |
classResolvedEnabled
|
private static Object |
classResolvedLock
|
private static Callbacks.CallbackList |
defineClassCallbacks
defineclass call callback list. |
private static boolean |
defineClassEnabled
|
private static Object |
defineClassLock
|
private static Callbacks.CallbackList |
exitCallbacks
VM exit callback list. |
private static boolean |
exitCallbacksStarted
|
private static Object |
exitLock
|
private static Callbacks.CallbackList |
forNameCallbacks
forName call callback list. |
private static boolean |
forNameEnabled
|
private static Object |
forNameLock
|
private static Callbacks.CallbackList |
loadClassCallbacks
loadclass call callback list. |
private static boolean |
loadClassEnabled
|
private static Object |
loadClassLock
|
private static Callbacks.CallbackList |
methodCompileCallbacks
Method compile callback list. |
private static boolean |
methodCompileEnabled
|
private static Object |
methodCompileLock
|
private static Callbacks.CallbackList |
methodOverrideCallbacks
Method override callback list. |
private static boolean |
methodOverrideEnabled
|
private static Object |
methodOverrideLock
|
private static Callbacks.CallbackList |
recompileAllCallbacks
Recompile all callback list. |
private static Object |
recompileAllLock
|
private static Callbacks.CallbackList |
startupCallbacks
VM startup callback list. |
private static boolean |
startupEnabled
|
private static Object |
startupLock
|
private static boolean |
TRACE_ADDMONITOR
|
private static boolean |
TRACE_APP_COMPLETE
|
private static boolean |
TRACE_APP_RUN_COMPLETE
|
private static boolean |
TRACE_APP_RUN_START
|
private static boolean |
TRACE_APP_START
|
private static boolean |
TRACE_BOOTIMAGE
|
private static boolean |
TRACE_CLASSINITIALIZED
|
private static boolean |
TRACE_CLASSINSTANTIATED
|
private static boolean |
TRACE_CLASSLOADED
|
private static boolean |
TRACE_CLASSRESOLVED
|
private static boolean |
TRACE_DEFINECLASS
|
private static boolean |
TRACE_EXIT
|
private static boolean |
TRACE_FORNAME
|
private static boolean |
TRACE_LOADCLASS
|
private static boolean |
TRACE_METHODCOMPILE
|
private static boolean |
TRACE_METHODOVERRIDE
|
private static boolean |
TRACE_RECOMPILE_ALL
|
private static boolean |
TRACE_STARTUP
|
Constructor Summary | |
---|---|
Callbacks()
|
Method Summary | |
---|---|
static void |
addAppCompleteMonitor(Callbacks.AppCompleteMonitor cb)
Register a callback for when the application completes executing |
static void |
addAppRunCompleteMonitor(Callbacks.AppRunCompleteMonitor cb)
Register a callback for when the application completes a run |
static void |
addAppRunStartMonitor(Callbacks.AppRunStartMonitor cb)
Register a callback for when the application starts a run |
static void |
addAppStartMonitor(Callbacks.AppStartMonitor cb)
Register a callback for when the application starts executing |
static void |
addBootImageMonitor(Callbacks.BootImageMonitor cb)
Register a callback for boot image writing. |
static void |
addClassInitializedMonitor(Callbacks.ClassInitializedMonitor cb)
Register a callback for class initialization. |
static void |
addClassInstantiatedMonitor(Callbacks.ClassInstantiatedMonitor cb)
Register a callback for class instantiation. |
static void |
addClassLoadedMonitor(Callbacks.ClassLoadedMonitor cb)
Register a callback for class loading. |
static void |
addClassResolvedMonitor(Callbacks.ClassResolvedMonitor cb)
Register a callback for class resolution. |
static void |
addDefineClassMonitor(Callbacks.DefineClassMonitor cb)
Register a callback for defineClass call. |
static void |
addExitMonitor(Callbacks.ExitMonitor cb)
Register a callback for VM exit. |
static void |
addForNameMonitor(Callbacks.ForNameMonitor cb)
Register a callback for forName call. |
static void |
addLoadClassMonitor(Callbacks.LoadClassMonitor cb)
Register a callback for loadClass call. |
static void |
addMethodCompileMonitor(Callbacks.MethodCompileMonitor cb)
Register a callback for method compile. |
static void |
addMethodOverrideMonitor(Callbacks.MethodOverrideMonitor cb)
Register a callback for method override. |
static void |
addRecompileAllDynamicallyLoadedMethodsMonitor(Callbacks.RecompileAllDynamicallyLoadedMethodsMonitor cb)
Register a callback for when the application requests to recompile all dynamically loaded classes |
static void |
addStartupMonitor(Callbacks.StartupMonitor cb)
Register a callback for VM startup. |
static void |
boot()
Perform boot-time actions. |
private static Atom |
getClass(Object o)
Return class name of the object. |
private static int |
getThread()
Return current thread id. |
static void |
init()
Initialize callbacks. |
static void |
notifyAppComplete(String app)
Notify the callback manager that the application completed executing Will return once all the callbacks are invoked. |
static void |
notifyAppRunComplete(String app,
int run)
Notify the callback manager that the application completed a run Will return once all the callbacks are invoked. |
static void |
notifyAppRunStart(String app,
int run)
Notify the callback manager that the application started a run Will return once all the callbacks are invoked. |
static void |
notifyAppStart(String app)
Notify the callback manager that the application started executing Will return once all the callbacks are invoked. |
static void |
notifyBootImage(Enumeration<String> types)
Notify the monitor that boot image writing is in progress. |
static void |
notifyClassInitialized(RVMClass klass)
Notify the callback manager that a class has been initialized. |
static void |
notifyClassInstantiated(RVMClass klass)
Notify the callback manager that a class has been instantiated. |
static void |
notifyClassLoaded(RVMClass klass)
Notify the callback manager that a class has been loaded. |
static void |
notifyClassResolved(RVMClass klass)
Notify the callback manager that a class has been resolved. |
static void |
notifyDefineClass(RVMType type)
Notify the monitor that java.lang.Class.defineclass was called. |
static void |
notifyExit(int value)
Notify the callback manager that the VM is about to exit. |
static void |
notifyForName(RVMType type)
Notify the monitor that java.lang.Class.forName was called. |
static void |
notifyLoadClass(RVMType type)
Notify the monitor that java.lang.Class.loadclass was called. |
static void |
notifyMethodCompile(RVMMethod method,
int compiler)
Notify the callback manager that a method is about to be compiled. |
static void |
notifyMethodOverride(RVMMethod method,
RVMMethod parent)
Notify the callback manager that a method has been overridden. |
static void |
notifyStartup()
Notify the callback manager that the VM has started up. |
private static void |
printStack(String message)
Print current stack trace. |
static void |
recompileAllDynamicallyLoadedMethods()
Notify the callback manager that the application requested a recompile all Will return once all the callbacks are invoked. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static Callbacks.CallbackList classLoadedCallbacks
private static final Object classLoadedLock
private static boolean classLoadedEnabled
private static Callbacks.CallbackList classResolvedCallbacks
private static final Object classResolvedLock
private static boolean classResolvedEnabled
private static Callbacks.CallbackList classInstantiatedCallbacks
private static final Object classInstantiatedLock
private static boolean classInstantiatedEnabled
private static Callbacks.CallbackList classInitializedCallbacks
private static final Object classInitializedLock
private static boolean classInitializedEnabled
private static Callbacks.CallbackList methodOverrideCallbacks
private static final Object methodOverrideLock
private static boolean methodOverrideEnabled
private static Callbacks.CallbackList methodCompileCallbacks
private static final Object methodCompileLock
private static boolean methodCompileEnabled
private static Callbacks.CallbackList forNameCallbacks
private static final Object forNameLock
private static boolean forNameEnabled
private static Callbacks.CallbackList defineClassCallbacks
private static final Object defineClassLock
private static boolean defineClassEnabled
private static Callbacks.CallbackList loadClassCallbacks
private static final Object loadClassLock
private static boolean loadClassEnabled
private static Callbacks.CallbackList bootImageCallbacks
private static final Object bootImageLock
private static boolean bootImageEnabled
private static Callbacks.CallbackList startupCallbacks
private static final Object startupLock
private static boolean startupEnabled
private static Callbacks.CallbackList exitCallbacks
private static final Object exitLock
private static boolean exitCallbacksStarted
private static Callbacks.CallbackList appStartCallbacks
private static final Object appStartLock
private static Callbacks.CallbackList appCompleteCallbacks
private static final Object appCompleteLock
private static Callbacks.CallbackList appRunStartCallbacks
private static final Object appRunStartLock
private static Callbacks.CallbackList appRunCompleteCallbacks
private static final Object appRunCompleteLock
private static Callbacks.CallbackList recompileAllCallbacks
private static final Object recompileAllLock
private static final boolean TRACE_ADDMONITOR
private static final boolean TRACE_CLASSLOADED
private static final boolean TRACE_CLASSRESOLVED
private static final boolean TRACE_CLASSINITIALIZED
private static final boolean TRACE_CLASSINSTANTIATED
private static final boolean TRACE_METHODOVERRIDE
private static final boolean TRACE_METHODCOMPILE
private static final boolean TRACE_FORNAME
private static final boolean TRACE_DEFINECLASS
private static final boolean TRACE_LOADCLASS
private static final boolean TRACE_BOOTIMAGE
private static final boolean TRACE_STARTUP
private static final boolean TRACE_EXIT
private static final boolean TRACE_APP_RUN_START
private static final boolean TRACE_APP_RUN_COMPLETE
private static final boolean TRACE_APP_START
private static final boolean TRACE_APP_COMPLETE
private static final boolean TRACE_RECOMPILE_ALL
Constructor Detail |
---|
public Callbacks()
Method Detail |
---|
public static void addClassLoadedMonitor(Callbacks.ClassLoadedMonitor cb)
cb
- the object to notify when event happenspublic static void notifyClassLoaded(RVMClass klass)
klass
- the class that was loadedpublic static void addClassResolvedMonitor(Callbacks.ClassResolvedMonitor cb)
cb
- the object to notify when event happenspublic static void notifyClassResolved(RVMClass klass)
klass
- the class that was resolvedpublic static void addClassInstantiatedMonitor(Callbacks.ClassInstantiatedMonitor cb)
cb
- the object to notify when event happenspublic static void notifyClassInstantiated(RVMClass klass)
klass
- the class that was instantiatedpublic static void addClassInitializedMonitor(Callbacks.ClassInitializedMonitor cb)
cb
- the object to notify when event happenspublic static void notifyClassInitialized(RVMClass klass)
klass
- the class that was initializedpublic static void addMethodOverrideMonitor(Callbacks.MethodOverrideMonitor cb)
cb
- the object to notify when event happenspublic static void notifyMethodOverride(RVMMethod method, RVMMethod parent)
method
- the method that was loadedparent
- the method that it overrides (null if none)public static void addMethodCompileMonitor(Callbacks.MethodCompileMonitor cb)
cb
- the object to notify when event happenspublic static void notifyMethodCompile(RVMMethod method, int compiler)
method
- the method that will be compiledcompiler
- the compiler that will be invoked
Values are constants in CompiledMethodpublic static void addForNameMonitor(Callbacks.ForNameMonitor cb)
cb
- the object to notify when event happenspublic static void notifyForName(RVMType type)
type
- the type that will be returnedpublic static void addDefineClassMonitor(Callbacks.DefineClassMonitor cb)
cb
- the object to notify when event happenspublic static void notifyDefineClass(RVMType type)
type
- the type that will be returnedpublic static void addLoadClassMonitor(Callbacks.LoadClassMonitor cb)
cb
- the object to notify when event happenspublic static void notifyLoadClass(RVMType type)
type
- the type that will be returnedpublic static void addBootImageMonitor(Callbacks.BootImageMonitor cb)
cb
- the object to notify when event happenspublic static void notifyBootImage(Enumeration<String> types)
types
- the types that are included in the boot imagepublic static void addStartupMonitor(Callbacks.StartupMonitor cb)
cb
- the object to notify when event happenspublic static void notifyStartup()
public static void addExitMonitor(Callbacks.ExitMonitor cb)
cb
- the object to notify when event happenspublic static void notifyExit(int value)
value
- the exit valuepublic static void addAppStartMonitor(Callbacks.AppStartMonitor cb)
cb
- the object to notify when event happenspublic static void notifyAppStart(String app)
app
- name of applicationpublic static void addAppCompleteMonitor(Callbacks.AppCompleteMonitor cb)
cb
- the object to notify when event happenspublic static void notifyAppComplete(String app)
app
- name of applicationpublic static void addAppRunStartMonitor(Callbacks.AppRunStartMonitor cb)
cb
- the object to notify when event happenspublic static void notifyAppRunStart(String app, int run)
app
- application namerun
- run numberpublic static void addAppRunCompleteMonitor(Callbacks.AppRunCompleteMonitor cb)
cb
- the object to notify when event happenspublic static void notifyAppRunComplete(String app, int run)
app
- name of applicationrun
- run numberpublic static void addRecompileAllDynamicallyLoadedMethodsMonitor(Callbacks.RecompileAllDynamicallyLoadedMethodsMonitor cb)
cb
- the object to notify when event happenspublic static void recompileAllDynamicallyLoadedMethods()
public static void init()
public static void boot()
private static Atom getClass(Object o)
o
- the object
private static int getThread()
private static void printStack(String message)
message
- error message
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |