public void suspend(int timeout) throws IOException {
if (!suspended) {
atmResource.setSerializer(serializer);
if (atmResource instanceof AtmosphereEventLifecycle) {
AtmosphereEventLifecycle ael = (AtmosphereEventLifecycle)atmResource;
ael.addEventListener(eventListener);
}
writer.suspend();
atmResource.suspend(timeout, false);
}
}