News for hackers. Stuff that matters.
Re:Exception Safety, Garbage Collection etc. (a.k.a. Why Doe... by aboodman on Friday May 06, 2011 @04:09PM (#2522286)
I am not super familiar with all the details of Java inner classes, but why can't you get most of the way there by doing something like:

  DB.open(new Runnable() {
    public void run() {
      // ... do stuff here ...
    }
  });
You can even design your resource layers such that they can only be used this way (or are easiest to use this way).

Basically, I'm just stealing the JavaScript-y way of doing this that uses closures:

  DB.open(function() {
    ...
  });
Re:Exception Safety, Garbage Collection etc. (a.k.a. Why Doe... by aboodman on Friday May 06, 2011 @06:34PM (#2522726)
Answer: the inner class can only access constant locals :(. So you have to put any mutable state in members.

Blech. This might work for some cases, but would be a huge pain in the ass in others.