Java Code Examples for java.util.concurrent.ConcurrentLinkedDeque#addAll()

The following examples show how to use java.util.concurrent.ConcurrentLinkedDeque#addAll() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConcurrentLinkedDequeTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * addAll(null) throws NPE
 */
public void testAddAll1() {
    ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
    try {
        q.addAll(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 2
Source File: ConcurrentLinkedDequeTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * addAll(this) throws IAE
 */
public void testAddAllSelf() {
    ConcurrentLinkedDeque q = populatedDeque(SIZE);
    try {
        q.addAll(q);
        shouldThrow();
    } catch (IllegalArgumentException success) {}
}
 
Example 3
Source File: ConcurrentLinkedDequeTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * addAll of a collection with null elements throws NPE
 */
public void testAddAll2() {
    ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
    try {
        q.addAll(Arrays.asList(new Integer[SIZE]));
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 4
Source File: ConcurrentLinkedDequeTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * addAll of a collection with any null elements throws NPE after
 * possibly adding some elements
 */
public void testAddAll3() {
    ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
    Integer[] ints = new Integer[SIZE];
    for (int i = 0; i < SIZE - 1; ++i)
        ints[i] = new Integer(i);
    try {
        q.addAll(Arrays.asList(ints));
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 5
Source File: ConcurrentLinkedDequeTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * addAll(null) throws NPE
 */
public void testAddAll1() {
    ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
    try {
        q.addAll(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 6
Source File: ConcurrentLinkedDequeTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * addAll(this) throws IAE
 */
public void testAddAllSelf() {
    ConcurrentLinkedDeque q = populatedDeque(SIZE);
    try {
        q.addAll(q);
        shouldThrow();
    } catch (IllegalArgumentException success) {}
}
 
Example 7
Source File: ConcurrentLinkedDequeTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * addAll of a collection with null elements throws NPE
 */
public void testAddAll2() {
    ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
    try {
        q.addAll(Arrays.asList(new Integer[SIZE]));
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 8
Source File: ConcurrentLinkedDequeTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * addAll of a collection with any null elements throws NPE after
 * possibly adding some elements
 */
public void testAddAll3() {
    ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
    Integer[] ints = new Integer[SIZE];
    for (int i = 0; i < SIZE - 1; ++i)
        ints[i] = new Integer(i);
    try {
        q.addAll(Arrays.asList(ints));
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 9
Source File: GoogleWebmasterExtractorIterator.java    From incubator-gobblin with Apache License 2.0 5 votes vote down vote up
private void onSuccess(ProducerJob job, List<String[]> results, LinkedBlockingDeque<String[]> responseQueue,
    ConcurrentLinkedDeque<ProducerJob> pagesToRetry) {
  int size = results.size();
  if (size == GoogleWebmasterClient.API_ROW_LIMIT) {
    List<? extends ProducerJob> granularJobs = job.partitionJobs();
    if (granularJobs.isEmpty()) {
      //The job is not divisible
      //TODO: 99.99% cases we are good. But what if it happens, what can we do?
      log.warn(String.format(
          "There might be more query data for your job %s. Currently, downloading more than the Google API limit '%d' is not supported.",
          job, GoogleWebmasterClient.API_ROW_LIMIT));
    } else {
      log.info(String.format("Partition current job %s", job));
      pagesToRetry.addAll(granularJobs);
      return;
    }
  }

  log.debug(String.format("Finished %s. Current Queue size: %d. Record size: %d.", job, responseQueue.size(), size));
  try {
    for (String[] r : results) {
      responseQueue.put(r);
    }
  } catch (InterruptedException e) {
    log.error(e.getMessage());
    throw new RuntimeException(e);
  }
}
 
Example 10
Source File: DedupEntity.java    From eagle with Apache License 2.0 4 votes vote down vote up
public ConcurrentLinkedDeque<DedupValue> getDedupValuesInConcurrentLinkedDeque() {
    ConcurrentLinkedDeque<DedupValue> result = new ConcurrentLinkedDeque<DedupValue>();
    result.addAll(this.getDedupValues());
    return result;
}