199 Lotus blogs updated hourly. Who will post next? Home | Blogs | Search | About 
 
Latest 7 Posts
IBM Champion!
Thu, Dec 15th 2016 5
From 3000 milliseconds to 200 to open a page: Speed up your Notes Client applications by discovering their bottlenecks.
Wed, Nov 30th 2016 9
Host your migrated Domino Data in Switzerland at ch.ldcvia.com
Mon, Nov 14th 2016 5
Why do Software Developers always squawk when inheriting a foreign codebase?
Tue, Oct 4th 2016 5
LDC Via is a dream destination for migrated Notes applications
Tue, Aug 30th 2016 8
Software is an iceberg. You’ll get hurt by the submerged parts.
Fri, Feb 19th 2016 8
getting git
Tue, Dec 22nd 2015 4
Top 10
calling Word’s Find and Replace using LotusScript
Fri, May 9th 2014 9
From 3000 milliseconds to 200 to open a page: Speed up your Notes Client applications by discovering their bottlenecks.
Wed, Nov 30th 2016 9
Software is an iceberg. You’ll get hurt by the submerged parts.
Fri, Feb 19th 2016 8
LDC Via is a dream destination for migrated Notes applications
Tue, Aug 30th 2016 8
NSF/NIF transactions : Names which appear in the Debug_Outfile.
Mon, Apr 7th 2014 6
Tim Tripcony’s incinerate function elegantly batch recycles Domino Objects in Java
Tue, Nov 4th 2014 6
Why do Software Developers always squawk when inheriting a foreign codebase?
Tue, Oct 4th 2016 5
Host your migrated Domino Data in Switzerland at ch.ldcvia.com
Mon, Nov 14th 2016 5
IBM Champion!
Thu, Dec 15th 2016 5
Finding comments from Tim or Jens in forums and blogs
Mon, May 19th 2014 4


Tim Tripcony’s incinerate function elegantly batch recycles Domino Objects in Java
Twitter Google+ Facebook LinkedIn Addthis Email Gmail Flipboard Reddit Tumblr WhatsApp StumbleUpon Yammer Evernote Delicious
andrewmagerman    

I recently was surfing through Stackoverflow and I hit a response from Tim Tripcony on this post: What is the best way to recycle Domino Objects in Java Beans

He published a small helper function to recycle an arbitrary number of Domino objects. It’s so simple, and so well written, that I thought it deserved a post of its own. Here it is in all its glory:

private void incinerate(Object... dominoObjects) {
    for (Object dominoObject : dominoObjects) {
        if (null != dominoObject) {
            if (dominoObject instanceof Base) {
                try {
                    ((Base)dominoObject).recycle();
                } catch (NotesException recycleSucks) {
                    // optionally log exception
                }
            }
        }
    }
}

And it’s used like this:

   Database wDb = null;
    View wView = null;
    Document wDoc = null;
    try {
// your code here
    } catch (NotesException ne) {
 // do error handling
    } finally {
        incinerate(wDoc, wView, wDb);
}

I find the function elegant in many ways; the function and the variables are clearly named, Tim uses variable-length argument lists (thats the Object… part with the ellipsis), the new for-each iteration, plus there is some humour. Thanks, Tim.




---------------------
http://blog.magerman.com/2014/11/04/tim-tripconys-incinerate-function-elegantly-batch-recycles-domino-objects-in-java/
Nov 04, 2014
7 hits



Recent Blog Posts
5
IBM Champion!
Thu, Dec 15th 2016 12:21p   Andrew Magerman
A
9
From 3000 milliseconds to 200 to open a page: Speed up your Notes Client applications by discovering their bottlenecks.
Wed, Nov 30th 2016 4:22p   Andrew Magerman
A
5
Host your migrated Domino Data in Switzerland at ch.ldcvia.com
Mon, Nov 14th 2016 11:19a   Andrew Magerman
A
5
Why do Software Developers always squawk when inheriting a foreign codebase?
Tue, Oct 4th 2016 4:29a   Andrew Magerman
A
8
LDC Via is a dream destination for migrated Notes applications
Tue, Aug 30th 2016 8:49a   Andrew Magerman
A




Created and Maintained by Yancy Lent - About - Planet Lotus Blog - Advertising - Mobile Edition