Annotation Type DoNotTrace


  • @Target(METHOD)
    @Retention(CLASS)
    public @interface DoNotTrace
    The com.vmlens.annotation.DoNotTrace annotation lets you define methods that should not be traced by vmlens. This allows you to enforce a specific ordering of your thread without influencing the data race detection of vmlens. In the following example, the CountDownLatch creates a happens-before relation between the i++ in the methods updateBefore and updateAfter:
     public class UpdateWithDoNotTrace {
        private int i = 0;
        final   CountDownLatch countDownLatch = 
            new CountDownLatch(1);  
        @DoNotTrace
        private void signal() {
            countDownLatch.countDown();
        }
        @DoNotTrace
        private void wait4Signal() 
                throws InterruptedException {
            countDownLatch.await();
        }
        public void updateBefore() {
            i++;
            signal();
        }
        public void updateAfter() 
                throws InterruptedException {
            wait4Signal();
            i++;
        }
    }