Package java.util.concurrent.atomic

Examples of java.util.concurrent.atomic.AtomicInteger.intValue()


        final AtomicInteger score;
        synchronized (map) {
            score = map.remove(obj);
            if (score == null) return 0;
        }
        return score.intValue();
    }

    public boolean containsKey(final E obj) {
        synchronized (map) {
            return map.containsKey(obj);
View Full Code Here


        final AtomicInteger score;
        synchronized (map) {
            score = map.get(obj);
        }
        if (score == null) return 0;
        return score.intValue();
    }
   
    public SortedMap<E, AtomicInteger> tailMap(E obj) {
        if (this.map instanceof TreeMap) {
            return ((TreeMap<E, AtomicInteger>) this.map).tailMap(obj);
View Full Code Here

    for (Exception exception : exceptionHolder) {
      System.err.println("exception: "+exception.getMessage());
      exception.printStackTrace();
    }
    assertTrue("Exceptions #" + exceptionHolder.size(), exceptionHolder.size() == 0);       
    assertEquals("Not all threads has finished", 3, finfishCount.intValue());
  }
 
  private void startThreadUpdateBGArea(final String areaName, final int maxLoop, final List<Exception> exceptionHolder,
      final int sleepTime, final AtomicInteger finishedCount) {
    // thread 2 : update,copy
View Full Code Here

    for (Exception exception : exceptionHolder) {
      System.err.println("exception: "+exception.getMessage());
      exception.printStackTrace();
    }
    assertTrue("Exceptions #" + exceptionHolder.size(), exceptionHolder.size() == 0);       
    assertEquals("Not all threads has finished", 3, finfishCount.intValue());
  }


  /**
   * thread 1 : try to create - sleep - delete sleep
View Full Code Here

    private int get() {
        AtomicInteger i = count.get();
        if (i == null) {
            return 0;
        } else {
            return i.intValue();
        }
    }

    private void increment() {
        AtomicInteger i = count.get();
View Full Code Here

                  }
                }

              }.start();

              while (counter.intValue() < parallelRuns) {
                try {
                  Thread.sleep(100);
                } catch (InterruptedException e) {
                  Thread.currentThread().interrupt();
                }
View Full Code Here

                WorkflowInterpreter.this.config.getGUI().getErrorWindow().error(e);
              }
            }

          }.start();
          while (counter.intValue() < parallelRuns) {
            try {
              Thread.sleep(100);
            } catch (InterruptedException e) {
              Thread.currentThread().interrupt();
            }
View Full Code Here

        for ( List<String> valueList : data )
        {
            AtomicInteger width = columnWidths.get(columnIndex++);
            for ( String value : valueList )
            {
                width.set(Math.max(value.length(), width.intValue()));
            }
        }

        return columnWidths;
    }
View Full Code Here

      }
    };
    new ItunesMusicLibraryParserImpl(
        new ResourceUtil(ITUNES_INDEX_FILE).getInputStream(), callback);
 
    Assert.assertEquals(10, counter.intValue());
  }
 
}
View Full Code Here

            LOG.trace("Starting to submit parallel tasks");

            while (it.hasNext()) {
                final ProcessorExchangePair pair = it.next();
                final Exchange subExchange = pair.getExchange();
                updateNewExchange(subExchange, total.intValue(), pairs, it);

                completion.submit(new Callable<Exchange>() {
                    public Exchange call() throws Exception {
                        // only start the aggregation task when the task is being executed to avoid staring
                        // the aggregation task to early and pile up too many threads
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.