Package com.xuggle.ferry

Examples of com.xuggle.ferry.AtomicInteger


    val = 0;
  }
  @Test
  public void testCreation()
  {
    ai = new AtomicInteger();
    val = ai.get();
    assertTrue("not initialized correctly", val == 0);
   
    ai = new AtomicInteger(5);
    val = ai.get();
    assertTrue("not intialized correctly", val == 5);
  }
View Full Code Here


 
  @Test
  @Ignore
  public void testIsAtomic()
  {
    ai = new AtomicInteger();
    assertTrue("is not using JVM for atomic locks", ai.isAtomic());
  }
View Full Code Here

  }
 
  @Test
  public void testSet()
  {
    ai = new AtomicInteger(8);
    val = ai.get();
    assertTrue(val == 8);
    ai.set(15);
    val = ai.get();
    assertTrue(val == 15);
View Full Code Here

  }
 
  @Test
  public void testGetAndDoSomethingMethods()
  {
    ai = new AtomicInteger();
   
    val = ai.getAndAdd(5);
    assertTrue(val == 0);
    assertTrue(ai.get() == 5);
   
View Full Code Here

  }
 
  @Test
  public void testDoSomethingAndGetMethods()
  {
    ai = new AtomicInteger();
    val = ai.addAndGet(5);
    assertTrue(val == 5);
    assertTrue(ai.get() == 5);
   
    val = ai.incrementAndGet();
View Full Code Here

  }

  @Test
  public void testCompareAndSet()
  {
    ai = new AtomicInteger(10);
    val = ai.get();

    assertTrue(val == 10);
    boolean result = false;
   
View Full Code Here

  public void testMultiThreadCompetition()
  {
    Thread threads[] = new Thread[10];
    int i = 0;
   
    ai = new AtomicInteger(0);
   
    for(i = 0; i< threads.length; i++)
    {
      // fire up each of our threads
      threads[i] = new Thread(new Runnable() {
View Full Code Here

TOP

Related Classes of com.xuggle.ferry.AtomicInteger

Copyright © 2018 www.massapicom. 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.