Package org.apache.niolex.commons.test

Examples of org.apache.niolex.commons.test.SleepStage.shutdown()


    this.startAdjust(ss, f);
    psize = ss.currentPoolSize;
    System.out.println("stage7 " + ss.currentPoolSize);
    assertEquals(psize, 1);
    // done.
    ss.shutdown();
  }

}
View Full Code Here


      Thread.sleep(1);
    }
    //
    System.out.println("stage 5. shutdown now.");
    Thread.sleep(100);
    s.shutdown();
    adj.stopAdjust();
  }

}
View Full Code Here

   * Test method for {@link org.apache.niolex.commons.seda.Stage#Stage(java.lang.String)}.
   */
  @Test
  public final void testShutdownSend() {
    SleepStage ss = new SleepStage("abc", dispatcher);
    ss.shutdown();
    ss = spy(ss);
    TInput in = mock(TInput.class);
    ss.addInput(in);
    ArgumentCaptor<RejectType> cap = ArgumentCaptor.forClass(RejectType.class);
    verify(ss).reject(cap.capture(), eq("abc"), eq(in));
View Full Code Here

    when(in.getTag()).thenReturn(65432);
    ss.addInput(in);
    Thread.sleep(100);
    assertEquals(RejectType.PROCESS_ERROR, one.a);
    assertEquals(ss.getInputSize(), 0);
    ss.shutdown();
    assertNull(ss.takeMessage());
    Thread.sleep(100);
    assertEquals(3, ss.getStageStatus());
    assertNull(ss.takeMessage());
  }
View Full Code Here

    assertFalse(w.isWorking());
    ss.construct();
    ss.subtractThread();
    ss.subtractThread();
    ss.subtractThread();
    ss.shutdown();
  }

    @Test
    public void testAdjustThreadPool() throws Exception {
        SleepStage ss = new SleepStage("abcdef", 123);
View Full Code Here

    public void testAdjustThreadPool() throws Exception {
        SleepStage ss = new SleepStage("abcdef", 123);
        ss.adjustThreadPool();
        ss.adjustThreadPool();
        ss.adjustThreadPool();
        ss.shutdown();
        Field f = Stage.class.getDeclaredField("lastAdjustTime");
        f.setAccessible(true);
        f.setLong(ss, 100);
        ss.adjustThreadPool();
        ss.adjustThreadPool();
View Full Code Here

    // stage 10.
    ss.exeCnt.addAndGet(3);
    this.startAdjust(ss, f);
    System.out.println("stage10 " + ss.currentPoolSize);
    assertEquals(1, ss.currentPoolSize);
    ss.shutdown();
  }

  /**
   * Test method for {@link org.apache.niolex.commons.seda.Stage#adjustThreadPool()}.
   */
 
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.