List of usage examples for org.apache.wicket.util.time Time elapsedSince
public Duration elapsedSince()
Time
value. From source file:org.wicketstuff.chat.channel.TimerChannelBehavior.java
License:Apache License
public static boolean isConnected(final Application application, final String id, final Duration timeout) { final Time time = TimerChannelBehavior.getLastPollEvent(application, id); boolean isConnected; if (time == null) { // the behavior has been cleaned return false; }/*from ww w . ja v a 2s.co m*/ isConnected = time.elapsedSince().compareTo(timeout) < 0; if (!isConnected) { // timeout expired, the page is probably not connected anymore // we clean the metadata to avoid memory leak TimerChannelBehavior.cleanMetadata(application, id); } return isConnected; }