Lurker is a tiny common java agent, it is incubate from HouseMD.
> java -javaagent:lurker.jar=<url> ...
> java -Xbootclasspath/a:$JAVA_HOME/lib/tools.jar -jar lurker.jar <pid> <url>
Tips: In Mac OSX and using JDK6,
-Xbootclasspath/a:$JAVA_HOME/lib/tools.jar
should be ignored.
The url
should provide three informations:
- The
classpath
which can load thereal agent class
; - The
real agent class
name; - The optional configurations.
A example of url
is:
http://hostname/classpath?bootstrap=real.XXXAgent&key=value
curl
the url
, a text content of classpath should be return, it could tell lurker where to load the classes.
real.XXXAgent
is the real agent class
, which lurker should bootstrap first.
Then, key=value
would be configuration for instancing real.XXXAgent
.
Every real agent class
should have:
- A public constructor;
- A public void method named
apply
without any arguments.
The public constructor may have one or two arguments, like:
package real;
public class SimpleAgent {
public SimpleAgent() { ... }
public void apply() { ... }
}
public class ConfigurableAgent {
public ConfigurableAgent(Map<String, String> conf) { ... }
public void apply() { ... }
}
public class InstrumentationAgent {
public InstrumentationAgent(Instrumentation inst) { ... }
public void apply() { ... }
}
public class SuperAgent {
public SuperAgent(Map<String, String> conf, Instrumentation inst) { ... }
public void apply() { ... }
}
Copyright 2013 zhongl
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.