Created
August 20, 2010 14:05
-
-
Save anonymous/540383 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.mobicents.slee.annotations.examples.sbb; | |
// ... | |
@Service(name="ExampleSbb",vendor="javax.slee",version="1.0", | |
rootSbb=SimpleExampleAnnotatedSbb.class) | |
@Sbb(name="ExampleSbb",vendor="javax.slee",version="1.0") | |
public abstract class SimpleExampleAnnotatedSbb extends SbbExt { | |
private static final long TIMER_DURATION = 1000; | |
@TracerField | |
private Tracer tracer; | |
@SbbContextExtField | |
private SbbContextExt sbbContextExt; | |
@CMPField | |
private Long startTime; | |
@ServiceStartedEventHandler | |
public void onServiceStartedEvent(ServiceStartedEvent event, | |
ActivityContextInterface aci) { | |
tracer.info("service started"); | |
sbbContextExt.getTimerFacility().setTimer(aci, null, TIMER_DURATION, | |
new TimerOptions()); | |
startTime = Long.valueOf(System.currentTimeMillis()); | |
} | |
@TimerEventHandler | |
public void onTimerEvent(TimerEvent event, ActivityContextInterface aci) { | |
long delay = (System.currentTimeMillis()-TIMER_DURATION) - startTime; | |
tracer.info("timer expired, delay = "+delay+" ms."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment