Have you looked at https://github.com/Netflix/RxJava by chance? I've been dying to see somebody do an RxJava in JavaFX ever since devoxx and it looks like you may have inadvertently started down that path :-).
Richard On Dec 16, 2013, at 8:09 AM, Tomas Mikula <tomas.mik...@gmail.com> wrote: > On Mon, Dec 16, 2013 at 1:47 AM, Tomas Mikula <tomas.mik...@gmail.com> wrote: >> On Mon, Dec 16, 2013 at 1:07 AM, Scott Palmer <swpal...@gmail.com> wrote: >>> Interesting, no worse than John's pattern though. >>> I thought of using a try/finally to make sure release was called and that >>> naturally lead to thinking of try-with-resources, where the "resource" in >>> this case is a binding of some sort (or a wrapper around a binding) that is >>> invalidated on close() if needed. >> >> That is an interesting idea. I didn't intend blockWhile() to be safe >> with respect to exceptions, but merely >> >> void blockWhile(Runnable r) { >> block(); >> r.run(); >> release(); >> } >> >> Enhancement you are suggesting could be fleshed out as block() >> returning an AutoCloseable and the usage would be >> >> try(AutoCloseable a = relaxedArea.block()) { >> obj.setWidth(w); >> obj.setHeight(h); >> } > > OK, done. I implemented both: > 1. added the blockWhile() method; > 2. made bindings AutoCloseable, and block() returns `this`. > > Tomas