try { IMethodCounter ctr = MethodCounterHelper.bind(); ctr.doSomething(); ctr.doSomething(); ctr.doSomething(); System.out.println("Result is " + ctr.getCount()); } catch (RegistryException e) { System.out.println(e); }