Posts

Showing posts with the label Concurrency

programmatically check thread lock in Multi Threaded Environment.

This Code below can check for thread locks in a concurrent environment. this code needs to be executed by a Deamon or Timer task.                 ThreadMXBean tmx = ManagementFactory.getThreadMXBean(); long[] ids = tmx.findDeadlockedThreads(); if (ids != null)                  { ThreadInfo[] infos = tmx.getThreadInfo(ids, true, true); LOG.fatal("********************************************The following threads                          are deadlocked:**************************************"); for (ThreadInfo ti : infos)                         { LOG.fatal(ti); } LOG.fatal("************************************************************                        ********************************...