How do I write a Java class that runs on the EPAgent?
search cancel

How do I write a Java class that runs on the EPAgent?


Article ID: 36460


Updated On:


CA Application Performance Management Agent (APM / Wily / Introscope) INTROSCOPE



  How do I write a Java class that runs on the EPAgent?

  The EPAgent is concerned with the following class:

    com.wily.introscope.epagent.ClassPlugIn extends EPAPlugIn

  The configuration should look something like


  The main() method is the entry point.

  The format for an EPAgent Java class is as follows:

    public static void main(String[], PrintStream) or public static void main(String[])

  If both formats are present, the first one takes precendence.

  The second format is only useful if planning on using the DataAPI to publish metrics. Use the first one if you want to use the existing "simple" or XML data formats.

  You can test the first variety stand-alone by doing something like:

    public class EPAPlugin

    public static void main(String[] args)
      main(args, System.out);

      public static void main(String[] args, PrintStream out)  {

  This way you can run it without the EPA harness and make sure the output looks right, then plug it into EPA unmodified and EPA will use the second entry point.

  Below is a sample class that can be compiled and run in the EPAgent with the following settings.

    lib\EPAgent.jar;lib\demoPlugIn.jar;lib\Agent.jar;lib\IntroscopeServices.jar com.wily.introscope.api.IntroscopeEPAgent
  introscope.epagent.stateless.MYCLASS.class=com.wily.epagent.plugins.TestPlugIn introscope.epagent.stateless.MYCLASS.delayInSeconds=60
  package com.wily.epagent.plugins;
  import java.util.Iterator;
  * Sample EPAgent Java class
  public class TestPlugIn implements Runnable { Logger logger =
  public void run() {
     while (true) {
       try {"Testing PlugIn " + this.getClass().getName());

       catch (InterruptedException e) { // TODO
         Auto-generated catch block e.printStackTrace(); }

      public static void main(String[] args) {
      new Thread(new TestPlugIn()).start();


Additional Information:

   This document was created to help you with your customization, any further help needed related to this Knowledge Document must be addressed by CA Professional Services.


Component: APMAGT