I/O Exception handling

I very much prefer this approach: OutputStream out = new MyOutputStream(…); //may throw IOException try { //use the stream } finally { out.close(); } than this: OutputStream out = null; try { out = new MyOutputStream(…); //may throw IOException //use the stream } finally { if (out != null) { out.close(); } } I just […]

I've been using some proprietary frameworks and libraries, that are using Files objects, and only File objects, everywhere in the interfaces. It's not that is bad to have methods accepting File objects, but it's not wise to accept only that. For example the DOM/SAX XML parser in the JDK, accept File object but includes also […]

Workaround to multi threaded testing

Since it has been introduced in JDK 1.5, I have loved the Executor abstraction over multi threaded execution. Basically you define tasks, implementing Runnable or Callable interfaces, and you submit those tasks to an Executor implementation, knowing that before or later the task will be processed. It's the Executor who knows how the tasks must […]




About

You are currently browsing the NewInstance weblog archives for patterns.

Longer entries are truncated. Click the headline of an entry to read it in its entirety.

Calendar

June 2017
M T W T F S S
« Nov    
 1234
567891011
12131415161718
19202122232425
2627282930  

Follow me

twitter flickr LinkedIn feed

Subscribe by email

Enter your email address:

Archives


Categories

Tag Cloud


Listening