Java ReentrantLock getLockInfo(ReentrantLock lock)

Here you can find the source of getLockInfo(ReentrantLock lock)

Description

get Lock Info

License

Open Source License

Declaration

private static String getLockInfo(ReentrantLock lock) 

Method Source Code

//package com.java2s;
/**************************************************************************************
 * Copyright (C) 2008 EsperTech, Inc. All rights reserved.                            *
 * http://esper.codehaus.org                                                          *
 * http://www.espertech.com                                                           *
 * ---------------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the GPL license       *
 * a copy of which has been included with this distribution in the license.txt file.  *
 **************************************************************************************/

import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

public class Main {
    private static String getLockInfo(ReentrantLock lock) {
        String lockid = "Lock@" + Integer.toHexString(lock.hashCode());
        return "lock " + lockid + " held=" + lock.getHoldCount() + " isHeldMe=" + lock.isHeldByCurrentThread()
                + " hasQueueThreads=" + lock.hasQueuedThreads();
    }/*w  ww. j  av  a2  s .  com*/

    private static String getLockInfo(ReentrantReadWriteLock lock) {
        String lockid = "RWLock@" + Integer.toHexString(lock.hashCode());
        return lockid + " readLockCount=" + lock.getReadLockCount() + " isWriteLocked=" + lock.isWriteLocked();
    }
}

Related

  1. getActivityLock()
  2. getAudioLock()
  3. getLock(String id)
  4. isRepair()
  5. lock()
  6. readSyncLock(String id)
  7. removeJavaStdLoggerHandlers()