alt.jiapi.util
Class HotSpotAdvice

java.lang.Object
  extended by alt.jiapi.util.HotSpotAdvice
Direct Known Subclasses:
DefaultAdvice

public abstract class HotSpotAdvice
extends java.lang.Object

HotSpotAdvice is an abstract base class for all of the advises used by HotSpotInstrumentor.

A HotSpotInstrumentor locates HotSpots according to its configuration. A HotSpot migh be an invocation, for example. Once hotspot is found HotSpotInstrumentor calls HotSpotAdvice.advice() method.

Body of the HotSpotAdvice.advice() is then copied into instrumented class.


Constructor Summary
HotSpotAdvice()
           
 
Method Summary
abstract  void advice()
          Each extending class must provide advice() method.
protected  void doHotSpot()
          This method should be called from advice() method, when the actual processing of hotspot is wanted.
protected  java.lang.String getHotSpotName()
          This method should be called only from advice() method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HotSpotAdvice

public HotSpotAdvice()
Method Detail

advice

public abstract void advice()
Each extending class must provide advice() method. Body of this method is copied into instrumented class.

The exact location, where method body gets copied into, depends how developer writes the method body.

A call to doHotSpot() in method body, is a tagging method call indicating that current hotspot should be executed.

For example, of we have a method foo()...

 public void foo() {
    bar.doSomeThing();
 }
 
...and HotSpotAdvisor.advice():
 public void advice() {
    long l1 = System.currentTimeMillis();
    doHotSpot();
    long l2 = System.currentTimeMillis();
    System.out.println("It took " + (l2-l1) + " ms");
 }
 
...then it would result in instrumented foo() method like
 public void foo() {
    long l1 = System.currentTimeMillis();
    bar.doSomething();
    long l2 = System.currentTimeMillis();
    System.out.println("It took " + (l2-l1) + " ms");
 }

 If a developer does not call doHotSpot() method in
 implementation of advice() method, corresponding hotspot
 gets replaced from instrumented class.

See Also:
doHotSpot()

doHotSpot

protected void doHotSpot()
This method should be called from advice() method, when the actual processing of hotspot is wanted.


getHotSpotName

protected java.lang.String getHotSpotName()
This method should be called only from advice() method.

Returns:
name of the HotSpot


Copyright © 2001. Documenation generated August 26 2011.