| java.lang.Object org.codehaus.aspectwerkz.hook.ProcessStarter
ProcessStarter | public class ProcessStarter (Code) | | ProcessStarter uses JPDA JDI api to start a VM with a runtime modified java.lang.ClassLoader, or transparently use a
Xbootclasspath style (java 1.3 detected or forced)
Important note
Due to a JPDA issue in LauchingConnector, this implementation is based on Process forking. If Xbootclasspath is not
used the target VM is started with JDWP options transport=dt_socket,address=9300 unless other specified.
It is possible after the short startup sequence to attach a debugger or any other JPDA attaching connector. It
has been validated against a WebLogic 7 startup and is the must use implementation.
Implementation Note
See http://java.sun.com/products/jpda/ See http://java.sun.com/j2se/1.4.1/docs/guide/jpda/jdi/index.html
For java 1.3, it launch the target VM using a modified java.lang.ClassLoader by generating it and putting it
in the bootstrap classpath of the target VM. The java 1.3 version should only be run for experimentation since it
breaks the Java 2 Runtime Environment binary code license by overriding a class of rt.jar
For java 1.4, it hotswaps java.lang.ClassLoader with a runtime patched version, wich is compatible with the
Java 2 Runtime Environment binary code license. For JVM not supporting the class hotswapping, the same mechanism as
for java 1.3 is used.
Usage
Use it as a replacement of "java" :
java [target jvm option] [target classpath]
targetMainClass [targetMainClass args]
should be called like:
java [jvm option] [classpath]
org.codehaus.aspectwerkz.hook.ProcessStarter [target jvm option] [target classpath] targetMainClass [targetMainClass
args]
[classpath] must contain %JAVA_HOME%/tools.jar for HotSwap support [target jvm option] can contain
JDWP options, transport and address are preserved if specified.
Options
[classpath] must contain %JAVA_HOME%/tools.jar and the jar you want for bytecode modification (asm, bcel, ...)
The java.lang.ClassLoader is patched using the -Daspectwerkz.classloader.clpreprocessor=... in
[jvm option]. Specify the FQN of your implementation of hook.ClassLoaderPreProcessor. See
org.codehaus.aspectwerkz.hook.ClassLoaderPreProcessor If not given, the default AspectWerkz layer 1 ASM
implementation hook.impl.* is used, which is equivalent to
-Daspectwerkz.classloader.clpreprocessor=org.codehaus.aspectwerkz.hook.impl.ClassLoaderPreProcessorImpl
Use -Daspectwerkz.classloader.wait=2 in [jvm option] to force a pause of 2 seconds between process fork and JPDA
connection for HotSwap. Defaults to no wait.
Disabling HotSwap
You disable HotSwap and thus force the use of -Xbootclasspath (like in java 1.3 mode) and specify the directory where
the modified class loader bytecode will be stored using in [jvm option]
-Daspectwerkz.classloader.clbootclasspath=... . Specify the directory where you want the patched
java.lang.ClassLoader to be stored. Default is "./_boot". The directory is created if needed (with the subdirectories
corresponding to package names). The directory is automatically incorporated in the -Xbootclasspath
option of [target jvm option]. You shoud use this option mainly for debuging purpose, or if you need to start
different jvm with different classloader preprocessor implementations.
Option for AspectWerkz layer 1 ASM implementation
When using the default AspectWerkz layer 1 ASM implementation
org.codehaus.aspectwerkz.hook.impl.ClassLoaderPreProcessorImpl , java.lang.ClassLoader is modified to
call a class preprocessor at each class load (except for class loaded by the bootstrap classloader). The
effective class preprocessor is defined with -Daspectwerkz.classloader.preprocessor=... in [target jvm
option]. Specify the FQN of your implementation of org.codehaus.aspectwerkz.hook.ClassPreProcessor interface. If
this parameter is not given, the default AspectWerkz layer 2
org.codehaus.aspectwerkz.transform.AspectWerkzPreProcessor is used.
author: Alexandre Vasseur |
CL_PRE_PROCESSOR_CLASSNAME_PROPERTY | final static String CL_PRE_PROCESSOR_CLASSNAME_PROPERTY(Code) | | option for classloader preprocessor target
|
parseJavaCommandLine | public String[] parseJavaCommandLine(String[] args)(Code) | | Analyse the args[] as a java command line
Parameters: args - String[] [0]:jvm options except -cp|-classpath, [1]:classpath without -cp, [2]: mainClass + mainOptions |
removeEmbracingQuotes | public static String removeEmbracingQuotes(String s)(Code) | | Remove first and last " or ' if any
Parameters: s - string to handle s whitout first and last " or ' if any |
|
|