當前位置: 首頁>>代碼示例>>Java>>正文


Java AbstractQueuedSynchronizer類代碼示例

本文整理匯總了Java中java.util.concurrent.locks.AbstractQueuedSynchronizer的典型用法代碼示例。如果您正苦於以下問題:Java AbstractQueuedSynchronizer類的具體用法?Java AbstractQueuedSynchronizer怎麽用?Java AbstractQueuedSynchronizer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AbstractQueuedSynchronizer類屬於java.util.concurrent.locks包,在下文中一共展示了AbstractQueuedSynchronizer類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: hasWaiters

import java.util.concurrent.locks.AbstractQueuedSynchronizer; //導入依賴的package包/類
/** {@inheritDoc} */
@Override public boolean hasWaiters(IgniteCondition condition) {
    try{
        initializeReentrantLock();

        AbstractQueuedSynchronizer.ConditionObject c = sync.conditionMap.get(condition.name());

        if (c == null)
            throw new IllegalArgumentException();

        return sync.hasWaiters(c);
    }
    catch (IgniteCheckedException e) {
        throw U.convertException(e);
    }
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:17,代碼來源:GridCacheLockImpl.java

示例2: getWaitQueueLength

import java.util.concurrent.locks.AbstractQueuedSynchronizer; //導入依賴的package包/類
/** {@inheritDoc} */
@Override public int getWaitQueueLength(IgniteCondition condition) {
    try{
        initializeReentrantLock();

        AbstractQueuedSynchronizer.ConditionObject c = sync.conditionMap.get(condition.name());

        if (c == null)
            throw new IllegalArgumentException();

        return sync.getWaitQueueLength(c);
    }
    catch (IgniteCheckedException e) {
        throw U.convertException(e);
    }
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:17,代碼來源:GridCacheLockImpl.java

示例3: waitForQueuedThread

import java.util.concurrent.locks.AbstractQueuedSynchronizer; //導入依賴的package包/類
/**
 * Spin-waits until sync.isQueued(t) becomes true.
 */
void waitForQueuedThread(AbstractQueuedSynchronizer sync, Thread t) {
    long startTime = System.nanoTime();
    while (!sync.isQueued(t)) {
        if (millisElapsedSince(startTime) > LONG_DELAY_MS)
            throw new AssertionFailedError("timed out");
        Thread.yield();
    }
    assertTrue(t.isAlive());
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:13,代碼來源:AbstractQueuedSynchronizerTest.java

示例4: assertHasQueuedThreads

import java.util.concurrent.locks.AbstractQueuedSynchronizer; //導入依賴的package包/類
/**
 * Checks that sync has exactly the given queued threads.
 */
void assertHasQueuedThreads(AbstractQueuedSynchronizer sync,
                            Thread... expected) {
    Collection<Thread> actual = sync.getQueuedThreads();
    assertEquals(expected.length > 0, sync.hasQueuedThreads());
    assertEquals(expected.length, sync.getQueueLength());
    assertEquals(expected.length, actual.size());
    assertEquals(expected.length == 0, actual.isEmpty());
    assertEquals(new HashSet<Thread>(actual),
                 new HashSet<Thread>(Arrays.asList(expected)));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:14,代碼來源:AbstractQueuedSynchronizerTest.java

示例5: assertHasExclusiveQueuedThreads

import java.util.concurrent.locks.AbstractQueuedSynchronizer; //導入依賴的package包/類
/**
 * Checks that sync has exactly the given (exclusive) queued threads.
 */
void assertHasExclusiveQueuedThreads(AbstractQueuedSynchronizer sync,
                                     Thread... expected) {
    assertHasQueuedThreads(sync, expected);
    assertEquals(new HashSet<Thread>(sync.getExclusiveQueuedThreads()),
                 new HashSet<Thread>(sync.getQueuedThreads()));
    assertEquals(0, sync.getSharedQueuedThreads().size());
    assertTrue(sync.getSharedQueuedThreads().isEmpty());
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:AbstractQueuedSynchronizerTest.java

示例6: assertHasSharedQueuedThreads

import java.util.concurrent.locks.AbstractQueuedSynchronizer; //導入依賴的package包/類
/**
 * Checks that sync has exactly the given (shared) queued threads.
 */
void assertHasSharedQueuedThreads(AbstractQueuedSynchronizer sync,
                                  Thread... expected) {
    assertHasQueuedThreads(sync, expected);
    assertEquals(new HashSet<Thread>(sync.getSharedQueuedThreads()),
                 new HashSet<Thread>(sync.getQueuedThreads()));
    assertEquals(0, sync.getExclusiveQueuedThreads().size());
    assertTrue(sync.getExclusiveQueuedThreads().isEmpty());
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:AbstractQueuedSynchronizerTest.java

示例7: example

import java.util.concurrent.locks.AbstractQueuedSynchronizer; //導入依賴的package包/類
ConditionObject example(AbstractQueuedSynchronizer sync) {
  return null;
}
 
開發者ID:google,項目名稱:error-prone,代碼行數:4,代碼來源:NestedClassTemplateExample.java

示例8: before

import java.util.concurrent.locks.AbstractQueuedSynchronizer; //導入依賴的package包/類
@BeforeTemplate
public ConditionObject before(AbstractQueuedSynchronizer sync) {
  return sync.new ConditionObject();
}
 
開發者ID:google,項目名稱:error-prone,代碼行數:5,代碼來源:NestedClassTemplate.java

示例9: after

import java.util.concurrent.locks.AbstractQueuedSynchronizer; //導入依賴的package包/類
@AfterTemplate
public ConditionObject after(AbstractQueuedSynchronizer sync) {
  return null;
}
 
開發者ID:google,項目名稱:error-prone,代碼行數:5,代碼來源:NestedClassTemplate.java

示例10: example

import java.util.concurrent.locks.AbstractQueuedSynchronizer; //導入依賴的package包/類
ConditionObject example(AbstractQueuedSynchronizer sync) {
  return sync.new ConditionObject();
}
 
開發者ID:google,項目名稱:error-prone,代碼行數:4,代碼來源:NestedClassTemplateExample.java

示例11: juclAQS_releaseShared

import java.util.concurrent.locks.AbstractQueuedSynchronizer; //導入依賴的package包/類
public static void juclAQS_releaseShared(AbstractQueuedSynchronizer owner, int arg, long pc) {
  writer.writeEvent(EventType.SIGNAL, tid(), pc, System.identityHashCode(owner), 0);
}
 
開發者ID:google,項目名稱:java-thread-sanitizer,代碼行數:4,代碼來源:EventListener.java

示例12: juclAQS_acquireSharedInterruptibly

import java.util.concurrent.locks.AbstractQueuedSynchronizer; //導入依賴的package包/類
public static void juclAQS_acquireSharedInterruptibly(AbstractQueuedSynchronizer owner,
                                                      int arg, long pc){
  writer.writeEvent(EventType.WAIT, tid(), pc, System.identityHashCode(owner), 0);
}
 
開發者ID:google,項目名稱:java-thread-sanitizer,代碼行數:5,代碼來源:EventListener.java

示例13: juclAQS_acquireShared

import java.util.concurrent.locks.AbstractQueuedSynchronizer; //導入依賴的package包/類
public static void juclAQS_acquireShared(AbstractQueuedSynchronizer owner, int arg, long pc){
  writer.writeEvent(EventType.WAIT, tid(), pc, System.identityHashCode(owner), 0);
}
 
開發者ID:google,項目名稱:java-thread-sanitizer,代碼行數:4,代碼來源:EventListener.java

示例14: juclAQS_tryAcquireSharedNanos

import java.util.concurrent.locks.AbstractQueuedSynchronizer; //導入依賴的package包/類
public static void juclAQS_tryAcquireSharedNanos(AbstractQueuedSynchronizer owner,
                                                 int arg, long nanos, boolean result, long pc) {
  if (result) {
    writer.writeEvent(EventType.WAIT, tid(), pc, System.identityHashCode(owner), 0);
  }
}
 
開發者ID:google,項目名稱:java-thread-sanitizer,代碼行數:7,代碼來源:EventListener.java


注:本文中的java.util.concurrent.locks.AbstractQueuedSynchronizer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。