Links

  • 1. Sogeti
  • 2. JBoss
  • 3. IBM
  • 4. Oracle
  • 5. SpringSource
  • 6. NL-JUG
  • 7. Java

Archives

Syndication  RSS 2.0

RSS 1.0
RSS 2.0

Bookmark this site

Add 'JCN Blog' site to delicious  Add 'JCN Blog' site to technorati  Add 'JCN Blog' site to digg  Add 'JCN Blog' site to dzone

Posted by Barend Garvelink at 0:25 on Tuesday 4 December    Add 'Be careful with Java.lang.Process streams' site to delicious  Add 'Be careful with Java.lang.Process streams' site to technorati  Add 'Be careful with Java.lang.Process streams' site to digg  Add 'Be careful with Java.lang.Process streams' site to dzone

A very useful piece of info on It’s just a Bunch of Stuff That Happens:

We’ve been plagued by an error similar to this in some long-running server code:

Exception in thread “main” java.io.IOException: Cannot run program “…whatever”: error=24, Too many open files

I am pretty sure I tracked down the problem: failure to correctly close Process resources. Consider the case where you create a Process and read data from its InputStream:

(note: this is not a complete example, plus it is wrong!)

// same thing occurs with Runtime.exec(...)
ProcessBuilder pb = new ProcessBuilder(args);
Process proc = pb.start();
InputStream in = proc.getInputStream();
// ...read from the stream in a thread
proc.waitFor();

// ...later, in a finally block, close the InputStream:
in.close();

That’s the general idea. Create a Process, capture output from one or more of the streams, and close the streams when complete.

Unfortunately, this is wrong.

Read the source article to see what’s wrong and why, and how to fix it. There’s a follow-up confirming the fix.

Posted by Barend Garvelink at 14:07 on Sunday 2 December    Add 'Why you shouldn’t use System.out' site to delicious  Add 'Why you shouldn’t use System.out' site to technorati  Add 'Why you shouldn’t use System.out' site to digg  Add 'Why you shouldn’t use System.out' site to dzone

Just a quick reminder. We all know this, but it doesn’t hurt to drive the point every once in a while. Here’s the source code for PrintStream.println(String):

    public void println(String x) {
	synchronized (this) {
	    print(x);
	    newLine();
	}
    }

Yup, all calls to this method (and its overloads), from anywhere in the JVM, patiently await their turn. Call it often enough, and your software might as well be single-threaded. Oh, and if the pipe is full, your entire application stops responding.

Face it, we all insert println()‘s during development, for a quick debug. This is perfectly fine, just be sure to clean up when you’re done. Use Log4E or AOP if you have to.

Posted by Barend Garvelink at 16:52 on Tuesday 25 September    Add 'Public ID’s, URL’s, URI’s, URN’s… waar staat die XSD nou?' site to delicious  Add 'Public ID’s, URL’s, URI’s, URN’s… waar staat die XSD nou?' site to technorati  Add 'Public ID’s, URL’s, URI’s, URN’s… waar staat die XSD nou?' site to digg  Add 'Public ID’s, URL’s, URI’s, URN’s… waar staat die XSD nou?' site to dzone

Op de website van JAXB kwam ik een link tegen naar een tutorial getiteld XML Entity and URI Resolvers. Hierin staat haarfijn op een rijtje hoe het nou zit met alle verschillende manieren die je hebt om een XML namespace te identificeren.

De Public (-//OASIS//DTD DocBook XML V4.1.2//EN) is uit zwang, maar kom je bij DTD’s nog veel tegen. De URI en de URL kennen dezelfde syntax maar verschillen in betekenis. De URN tenslotte is een beetje een buitenbeentje maar niet minder nuttig. Een en ander staat formeel beschreven in RFC 3986.

Het genoemde artikeltje behandelt de verschillende namespace ID’s, en behandelt bovendien de OASIS XML Catalog en de Resolver classes die je in de bekende Java XML API’s tegenkomt. Met deze systemen kan een, zegmaar, "abstracte" id worden herleid tot een bestand op een bekende locatie.

Handig als inleiding, handig als naslagwerk. bookmark me!

Posted by Hans-Jürgen Jacobs at 10:12 on Friday 3 August    Add 'Continuous Integration Book' site to delicious  Add 'Continuous Integration Book' site to technorati  Add 'Continuous Integration Book' site to digg  Add 'Continuous Integration Book' site to dzone

Updated web site: Continuous Integration is a topic that often brings people to my site. As a result it seems appropriate that I can now announce that Paul Duvall’s book on the subject (part of my signature series) is now out. [martinfowler.com]

Posted by Hans-Jürgen Jacobs at 15:25 on Monday 2 July    Add 'A quick guide for migrating to WebSphere Application Server V6.1' site to delicious  Add 'A quick guide for migrating to WebSphere Application Server V6.1' site to technorati  Add 'A quick guide for migrating to WebSphere Application Server V6.1' site to digg  Add 'A quick guide for migrating to WebSphere Application Server V6.1' site to dzone

This article is to help you get started migrating from IBM WebSphere Application Server Version 5.0.x, 5.1.x or 6.0.x to WebSphere Application Server Version 6.1. This article presents a high level overview of the WebSphere Application Server V6.1 migration tools and their usage, plus a summary of some special considerations that will apply when migrating from specific versions, for both single server and a managed cell. Read article here.

Posted by Hans-Jürgen Jacobs at 22:45 on Monday 1 May    Add 'The myth of “keeping up”' site to delicious  Add 'The myth of “keeping up”' site to technorati  Add 'The myth of “keeping up”' site to digg  Add 'The myth of “keeping up”' site to dzone

Do you have a stack of books, journals, manuals, articles, API docs, and blog printouts that you think you’ll get to? That you think you need to read? Now, based on past experience, what are the odds you’ll get to all of it? Half of it? Any of it? (except for maybe the Wired magazine) [headrush]

Posted by Hans-Jürgen Jacobs at 13:51 on Wednesday 8 March    Add 'Usability in One Easy Step' site to delicious  Add 'Usability in One Easy Step' site to technorati  Add 'Usability in One Easy Step' site to digg  Add 'Usability in One Easy Step' site to dzone

Bad usability in the design of aircraft controls can result in what is cheerfully referred to as CFIT: Controlled Flight Into Terrain. The usability of your product may not be quite as critical. If you’re lucky, the mistakes you make in usability design will merely cause people to lose limbs, or, heck, even just thumbs. No biggie!

Read on: Usability in One Easy Step

Posted by Hans-Jürgen Jacobs at 12:26 on Monday 9 May    Add 'Unit testing smells' site to delicious  Add 'Unit testing smells' site to technorati  Add 'Unit testing smells' site to digg  Add 'Unit testing smells' site to dzone

This is a list of unit testing smells. If some of these anti-patterns are present in your unit tests, you should probably be looking at refactoring them.

Author: Ian Bourke
Published: October 7, 2004 [testdriven.com]

Posted by Hans-Jürgen Jacobs at 16:16 on Wednesday 30 March    Add 'The Architecture Group' site to delicious  Add 'The Architecture Group' site to technorati  Add 'The Architecture Group' site to digg  Add 'The Architecture Group' site to dzone

An antipattern that I have seen in a few organizations, including my current employer, is the formation of an Architecture Group – an internal governing body and standards group rolled into one. [hacknot.info]

Posted by jongmarc at 10:37 on Friday 12 November    Add 'Goed advies over beveiliging PC' site to delicious  Add 'Goed advies over beveiliging PC' site to technorati  Add 'Goed advies over beveiliging PC' site to digg  Add 'Goed advies over beveiliging PC' site to dzone

Kijk, The Register doet aan advies tegenwoordig… http://www.theregister.co.uk/2004/11/11/av_workshop/


© 2019 Java Competence Network. All Rights Reserved.