Search in sources :

Example 1 with FixedThreadExecutor

use of io.servicecomb.core.executor.FixedThreadExecutor in project java-chassis by ServiceComb.

the class TestExecutors method testFixedThreadExecutor.

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

        @Override
        public void run() {
        }
    });
    Map<Long, Executor> threadExectorMap = Deencapsulation.getField(oFixedThreadExecutor, "threadExectorMap");
    Assert.assertEquals(true, (threadExectorMap.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() {
            // TODO Auto-generated method stub
            strThreadTest = "thread Ran";
        }
    });
    Assert.assertEquals("thread Ran", strThreadTest);
}
Also used : Executor(java.util.concurrent.Executor) FixedThreadExecutor(io.servicecomb.core.executor.FixedThreadExecutor) ReactiveExecutor(io.servicecomb.core.executor.ReactiveExecutor) FixedThreadExecutor(io.servicecomb.core.executor.FixedThreadExecutor) ReactiveExecutor(io.servicecomb.core.executor.ReactiveExecutor) Test(org.junit.Test)

Aggregations

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