[announce] InhiBeans: mitigate redundant recalculations

Tomas Mikula tomas.mikula at gmail.com
Mon Dec 16 08:09:17 PST 2013

On Mon, Dec 16, 2013 at 1:47 AM, Tomas Mikula <tomas.mikula at gmail.com> wrote:
> On Mon, Dec 16, 2013 at 1:07 AM, Scott Palmer <swpalmer at 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`.


More information about the openjfx-dev mailing list