Per the description the reason for this is resume was being called on the continuation before onAwakening.run() had executed.
Old Code:
onAwakening.run();
continuation.resume();
I fixed this (still need to get this reviewed by the team) by using an executor and Future to only resume the continuation when onAwakening.run() had finished executing:
// Flush bytes (if any) first before resuming as
// Grizzly Comet isn't allowing writes once the
// continuation is resumed.
ExecutorService executor = Executors.newFixedThreadPool(1);
Future<?> submit = executor.submit(onAwakening);
if (!Thread.currentThread().isInterrupted()) {
// Wait for onAwakening to complete.
submit.get();
// It is now ok to resume.
continuation.resume();
}
Per the description the reason for this is resume was being called on the continuation before onAwakening.run() had executed.
Old Code:
onAwakening.run();
continuation.resume();
I fixed this (still need to get this reviewed by the team) by using an executor and Future to only resume the continuation when onAwakening.run() had finished executing:
// Flush bytes (if any) first before resuming as
// Grizzly Comet isn't allowing writes once the
// continuation is resumed.
ExecutorService executor = Executors.newFixedThreadPool(1);
Future<?> submit = executor.submit(onAwakening);
if (!Thread.currentThread().isInterrupted()) { // Wait for onAwakening to complete. submit.get(); // It is now ok to resume. continuation.resume(); }