Monthly Archives: February 2012

Take care of net.sf.ehcache.transaction.TransactionTimeoutException

15-Feb-12

The net.sf.ehcache.transaction.TransactionTimeoutException is one of those unchecked RuntimeExceptions you should take care of if you use ehcache. If this exceptions occurs you must explicitly rollback the ongoing transaction, otherwise all further requests to start an ehcache transaction from within the current thread will fail with another net.sf.ehcache.transaction.TransactionException as the cache is in an inconsistent state. […]

Read the complete article »

Get the uptime of your Java VM

08-Feb-12

You don’t need JConsole or similar for just displaying the approximate uptime of your application respectively your Java Virtual Machine: import java.lang.management.ManagementFactory;   public class Demo { public static void main(String… args) { final long uptime = ManagementFactory.getRuntimeMXBean().getUptime(); System.out.println(String.format("Up for %dms", uptime)); } }import java.lang.management.ManagementFactory; public class Demo { public static void main(String… args) { […]

Read the complete article »