Skip to content

Instantly share code, notes, and snippets.

@dfilppi
Created February 22, 2012 23:59
Show Gist options
  • Save dfilppi/1888508 to your computer and use it in GitHub Desktop.
Save dfilppi/1888508 to your computer and use it in GitHub Desktop.
TimeWatcher polling container config
....
SimplePollingEventContainerListener pec=new
SimplePollingContainerConfigurer(space)
.template(query)
.transactionManager(tm)
.eventListenerAnnotation(new Object(){
@SpaceDataEvent
public TimeStamp eventListener(TimeStamp event){
TimeRecord lt=getSpace().readById(TimeRecord.class,
event.getLocation(),1,100,
ReadModifiers.EXCLUSIVE_READ_LOCK);
if(lt==null){
lt=new TimeRecord(event.getLocation());
}
lt.setTime(event);
getSpace().write(lt,LeaseContext.FOREVER,1000L,
UpdateModifiers.UPDATE_OR_WRITE|
UpdateModifiers.NO_RETURN_VALUE);
return null;
}
}).pollingContainer();
....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment