String (final String stackTrace) { Matcher m = ourWaitingForLockPattern.matcher(stackTrace); if (m.find()) { return m.group(2); } m = ourParkingToWaitForLockPattern.matcher(stackTrace); if (m.find()) { return m.group(1); } return null; }