本文整理了Java中java.util.concurrent.locks.ReentrantReadWriteLock.isWriteLocked
方法的一些代码示例,展示了ReentrantReadWriteLock.isWriteLocked
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ReentrantReadWriteLock.isWriteLocked
方法的具体详情如下:
包路径:java.util.concurrent.locks.ReentrantReadWriteLock
类名称:ReentrantReadWriteLock
方法名:isWriteLocked
[英]Queries if the write lock is held by any thread. This method is designed for use in monitoring system state, not for synchronization control.
[中]查询写锁是否由任何线程持有。该方法设计用于监控系统状态,而不是用于同步控制。
代码示例来源:origin: apache/hbase
public void waitForUpdates() {
if(!updatesLock.isWriteLocked()) {
updatesLock.writeLock().lock();
}
}
代码示例来源:origin: org.rhq/rhq-core-plugin-container
private String getFacetLockStatus() {
StringBuilder str = new StringBuilder("Facet lock status for [");
str.append(getResource());
str.append("], is-write-locked=[").append(facetAccessLock.isWriteLocked());
str.append("], is-write-locked-by-current-thread=[").append(facetAccessLock.isWriteLockedByCurrentThread());
str.append("], read-locks=[").append(facetAccessLock.getReadLockCount());
str.append("], waiting-for-lock-queue-size=[").append(facetAccessLock.getQueueLength());
str.append("]");
return str.toString();
}
代码示例来源:origin: OryxProject/oryx
@Test
public void testWriteLock() {
ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
AutoReadWriteLock al = new AutoReadWriteLock(lock);
assertFalse(lock.isWriteLocked());
try (AutoLock al2 = al.autoWriteLock()) {
assertTrue(lock.isWriteLocked());
}
assertFalse(lock.isWriteLocked());
}
代码示例来源:origin: net.sf.ehcache/ehcache
private boolean isFrozen() {
return freezeLock.isWriteLocked();
}
代码示例来源:origin: com.blazegraph/bigdata-core
/**
* Clear internal fields.
*/
private void reset() {
assert m_stateLock.isWriteLocked();
m_state = null;
m_position = headerSize0;
m_rootBlock = null;
m_nextSequence = 0L;
}
代码示例来源:origin: blazegraph/database
/**
* Clear internal fields.
*/
private void reset() {
assert m_stateLock.isWriteLocked();
m_state = null;
m_position = headerSize0;
m_rootBlock = null;
m_nextSequence = 0L;
}
代码示例来源:origin: cinchapi/concourse
@Override
public boolean isWriteLocked() {
return decorated.isWriteLocked();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
private boolean isFrozen() {
return freezeLock.isWriteLocked();
}
代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit
public boolean isWriteLocked()
{
return body.isWriteLocked();
} //}}}
代码示例来源:origin: net.sf.ehcache.internal/ehcache-core
private boolean isFrozen() {
return freezeLock.isWriteLocked();
}
代码示例来源:origin: org.terracotta.toolkit/terracotta-toolkit-1.3-impl
@SuppressWarnings("unused")
private void onShare() {
if (lock.localLock().isWriteLocked()) {
throw new IllegalStateException("You are attempting to share a TerracottaReadWriteLock.WriteLock when it is in a locked state. "
+ "Locks cannot be shared while locked.");
}
}
代码示例来源:origin: org.terracotta.toolkit/terracotta-toolkit-1.4-impl
@SuppressWarnings("unused")
private void onShare() {
if (lock.localLock().isWriteLocked()) {
throw new IllegalStateException("You are attempting to share a TerracottaReadWriteLock.WriteLock when it is in a locked state. "
+ "Locks cannot be shared while locked.");
}
}
代码示例来源:origin: it.ozimov/spring-boot-email-core
@Override
public void close() throws IOException {
if (currentOperationLock.isWriteLocked()) {
currentOperationLock.writeLock().unlock();
}
currentOperationLock.writeLock().lock();
currentOperation = CurrentOperation.CLOSING;
currentOperationLock.writeLock().unlock();
try {
queueLock.unlock();
} catch (IllegalMonitorStateException e) {
}
}
代码示例来源:origin: ozimov/spring-boot-email-tools
@Override
public void close() throws IOException {
if (currentOperationLock.isWriteLocked()) {
currentOperationLock.writeLock().unlock();
}
currentOperationLock.writeLock().lock();
currentOperation = CurrentOperation.CLOSING;
currentOperationLock.writeLock().unlock();
try {
queueLock.unlock();
} catch (IllegalMonitorStateException e) {
}
}
代码示例来源:origin: com.espertech/com.springsource.com.espertech.esper
private static String getLockInfo(ReentrantReadWriteLock lock)
{
String lockid = "RWLock@" + Integer.toHexString(lock.hashCode());
return lockid +
" readLockCount=" + lock.getReadLockCount() +
" isWriteLocked=" + lock.isWriteLocked();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.drools
private void notifyUpgradingThread() {
if (shouldTryAtomicUpgrade && tryingLockUpgrade.get()) {
synchronized (highPriorityMonitor) {
if (lock.getReadLockCount() < 2 && !lock.isWriteLocked()) {
// all the read locks, except the one of the thread that is trying to upgrade its lock, have been released
highPriorityMonitor.notifyAll();
}
}
}
}
代码示例来源:origin: espertechinc/esper
private static String getLockInfo(ReentrantReadWriteLock lock) {
String lockid = "RWLock@" + Integer.toHexString(lock.hashCode());
return lockid +
" readLockCount=" + lock.getReadLockCount() +
" isWriteLocked=" + lock.isWriteLocked();
}
代码示例来源:origin: org.terracotta.toolkit/terracotta-toolkit-1.4-impl
@SuppressWarnings("unused")
private void onShare() {
if ((localLock().getReadLockCount() > 0) || localLock().isWriteLocked()) {
throw new IllegalStateException("You are attempting to share a TerracottaReadWriteLock when it is in a locked state. "
+ "Locks cannot be shared while locked.");
}
}
代码示例来源:origin: org.terracotta.toolkit/terracotta-toolkit-1.3-impl
@SuppressWarnings("unused")
private void onShare() {
if ((localLock().getReadLockCount() > 0) || localLock().isWriteLocked()) {
throw new IllegalStateException("You are attempting to share a TerracottaReadWriteLock when it is in a locked state. "
+ "Locks cannot be shared while locked.");
}
}
代码示例来源:origin: apache/oozie
private void checkLockRelease(String path, MemoryLocksService lockService) {
if (lockService.getMemoryLocks().getLockMap().get(path) == null) {
// good lock is removed from memory after gc.
}
else {
assertFalse(lockService.getMemoryLocks().getLockMap().get(path).isWriteLocked());
}
}
内容来源于网络,如有侵权,请联系作者删除!