Skip to content

Instantly share code, notes, and snippets.

Created August 20, 2010 14:05
Show Gist options
  • Save anonymous/540383 to your computer and use it in GitHub Desktop.
Save anonymous/540383 to your computer and use it in GitHub Desktop.
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