Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] JGit Client API

The point is just that reporting errors when possible is better than nothing.

There are other techniques with better guarantees: you could lazily store open builders in a concurrent hash map  on the first "building activity", for instance (with an object or some other innocuous thing like an Integer as the value in the map), removing the builder when it is completed.  A shutdown hook could check the hash map and gripe if there are any maps in it.  Memory leaks will only happen if the program fails to call the build method and the shutdown hook will indicate this anyway.  If you want sommething a little more deluxe, you can optionally store a new exception in the map instead of an innocuous value (maybe do that by default).  The shutdown hook can display any exceptions in the map.  These exceptions will show where the first "building activity" occurred when the builders were registered with the map.

Anyway, these are just ideas that can help people find errors from incorrectly using builders.

On Mon, Apr 19, 2010 at 9:34 PM, Robin Rosenberg <robin.rosenberg@xxxxxxxxxx> wrote:
måndagen den 19 april 2010 13.14.12 skrev  Bill Burdick:
> What about at least logging a message with the finalize method of the
> builder if you don't send that final message?

Finalize isn't likely to be called if your program is short lived.

-- robin
jgit-dev mailing list

Back to the top