boolean () { if (ourApp.isReadAccessAllowed()) { return true; } ThreadInfo[] infos = ManagementFactory.getThreadMXBean().getThreadInfo(new long[]{Thread.currentThread().getId()}, true, false); return infos.length > 0 && infos[0].getLockedMonitors().length > 0; }