Search in sources :

Example 1 with FixedThreadExecutor

use of org.apache.servicecomb.core.executor.FixedThreadExecutor in project incubator-servicecomb-java-chassis by apache.

the class TestExecutors method testFixedThreadExecutor.

@Test
public void testFixedThreadExecutor() {
    FixedThreadExecutor oFixedThreadExecutor = new FixedThreadExecutor();
    oFixedThreadExecutor.execute(new Runnable() {

        @Override
        public void run() {
        }
    });
    Map<Long, Executor> threadExecutorMap = Deencapsulation.getField(oFixedThreadExecutor, "threadExecutorMap");
    Assert.assertEquals(true, (threadExecutorMap.size() > 0));
    List<Executor> executorList = Deencapsulation.getField(oFixedThreadExecutor, "executorList");
    Assert.assertEquals(true, (executorList.size() > 1));
    ReactiveExecutor oReactiveExecutor = new ReactiveExecutor();
    oReactiveExecutor.execute(new Runnable() {

        @Override
        public void run() {
            strThreadTest = "thread Ran";
        }
    });
    Assert.assertEquals("thread Ran", strThreadTest);
}
Also used : FixedThreadExecutor(org.apache.servicecomb.core.executor.FixedThreadExecutor) ReactiveExecutor(org.apache.servicecomb.core.executor.ReactiveExecutor) Executor(java.util.concurrent.Executor) FixedThreadExecutor(org.apache.servicecomb.core.executor.FixedThreadExecutor) ReactiveExecutor(org.apache.servicecomb.core.executor.ReactiveExecutor) Test(org.junit.Test)

Aggregations

Executor (java.util.concurrent.Executor)1 FixedThreadExecutor (org.apache.servicecomb.core.executor.FixedThreadExecutor)1 ReactiveExecutor (org.apache.servicecomb.core.executor.ReactiveExecutor)1 Test (org.junit.Test)1