Archive for January, 2010

testting google-code-prettify

import javax.ejb.Stateful;
import javax.interceptor.AroundInvoke;
import javax.interceptor.InvocationContext;

@Stateful
public class EmployeeBean implements EmployeeServiceLocal, EmployeeServiceRemote {

  public EmployeeBean() {
  }

  public void doAction() {
    System.out.println("Processing...");
  }

  @AroundInvoke
  public Object TimerLog(InvocationContext ctx) throws Exception {
    String beanClassName = ctx.getClass().getName();
    String businessMethodName = ctx.getMethod().getName();
    String target = beanClassName + "." + businessMethodName;
    long startTime = System.currentTimeMillis();
    System.out.println("Invoking " + target);
    try {
      return ctx.proceed();
    } finally {
      System.out.println("Exiting " + target);
      long totalTime = System.currentTimeMillis() - startTime;
      System.out.println("Business method " + businessMethodName + "in " + beanClassName + "takes "
          + totalTime + "ms to execute");
    }
  }
}

wpToGo test

Testing wpToGo from HTC Hero :P