if (cachedMessages.size() > 0) {
logger.trace("cached messages");
writeCache(r, cachedMessages);
return Action.CANCELLED;
} else {
r.addEventListener(new OnSuspend() {
public void onSuspend(AtmosphereResourceEvent event) {
r.removeEventListener(this);
logger.trace("onSuspend first");
final AtomicBoolean doNotSuspend = new AtomicBoolean(false);