Then, instead of having N methods returning a boolean I think it is more 
convenient to have only one returning the state. (Although IMHO, I don't see 
the point in explictly detecting a "closing" state, I think having the isOpen 
os isClose would be enough).

If there is more than one thread calling the close method, that means that N 
threads are sharing the same context object. It could be the responsibility of 
callers to properly synchronize those calls. Anyway, if it has to be made 
thread-safe, given that the closer is a singleton per context (and it should be 
only one), you could just declare the close method as synchronized. Since it is 
going to be invoked as the last operation, it should not be a problem to 
synchronize it.

Perhaps someone else have a string opinion on this (synchronizing stuff is 
always a conflictive thing :)).

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/32#issuecomment-19459935

Reply via email to