laforge49 / JActor2

Robust, Composable Actors
http://laforge49.github.io/projects/JActor2/index.html
60 stars 15 forks source link

reactor close should close in process requests #169

Closed laforge49 closed 10 years ago

laforge49 commented 10 years ago

There is a bug of sorts in the dining philosophers program in the tutorial. If the DiningTable's reactor is closed, any Philosopher with a persisted eat request will hang. The fix is to make the eat request a PersistentRequest which is a Closeable AsyncRequest.

When a reactor closes, it closes all of its closeables. If all persisted requests are closeable, then they will be closed, and that returns a ReactorClosedException to the request context, which in the above case will be the Philosophers.

laforge49 commented 10 years ago

Ouch! RequestImpl.close already cancels all in-process requests, which would include all persistent requests, so PersistentRequest should not be needed.

Ouch again! RequestImpl.close should close all in-process requests, not cancel them.