Use API available in JDK6