Search in sources :

Example 1 with SimpleScheduler

use of org.nustaq.kontraktor.impl.SimpleScheduler in project kontraktor by RuedigerMoeller.

the class MyHttpApp method init.

@Local
public void init() {
    // you won't need many threads. If there is heavy computing or you do blocking operations (hint: don't)
    // inside a session actor, increase this. It will still work with hundreds of threads (but then you get jee ;) )
    clientThreads = new Scheduler[] { // only two session processor threads should be sufficient for small apps.
    new SimpleScheduler(CLIENT_QSIZE, true), new SimpleScheduler(CLIENT_QSIZE, true) };
    Thread.currentThread().setName("MyHttpApp Dispatcher");
}
Also used : SimpleScheduler(org.nustaq.kontraktor.impl.SimpleScheduler) Local(org.nustaq.kontraktor.annotations.Local)

Example 2 with SimpleScheduler

use of org.nustaq.kontraktor.impl.SimpleScheduler in project kontraktor by RuedigerMoeller.

the class BasicWebAppActor method init.

@Local
public void init(C config) {
    int numSessionThreads = config.getNumSessionThreads();
    sessionThreads = new Scheduler[numSessionThreads];
    for (int i = 0; i < numSessionThreads; i++) {
        sessionThreads[i] = new SimpleScheduler(10_000, true);
    }
    sessionStorage = createSessionStorage(config);
    sessions = new HashMap<>();
}
Also used : SimpleScheduler(org.nustaq.kontraktor.impl.SimpleScheduler) Local(org.nustaq.kontraktor.annotations.Local)

Example 3 with SimpleScheduler

use of org.nustaq.kontraktor.impl.SimpleScheduler in project kontraktor by RuedigerMoeller.

the class ConstructionTest method creationTest.

@Test
public void creationTest() throws InterruptedException {
    ConstructionSampleActor act = Actors.AsActor(ConstructionSampleActor.class);
    act.test(SimpleScheduler.DEFQSIZE, act.__scheduler);
    ConstructionSampleActor act1 = Actors.AsActor(ConstructionSampleActor.class);
    act1.sameThread(act1.__currentDispatcher);
    act1.test(SimpleScheduler.DEFQSIZE, act1.__scheduler);
    SimpleScheduler scheduler = new SimpleScheduler(7000);
    ConstructionSampleActor act2 = Actors.AsActor(ConstructionSampleActor.class, scheduler);
    act2.notSameThread(act.__currentDispatcher);
    act2.test(8192, scheduler);
    ConstructionSampleActor act4 = Actors.AsActor(ConstructionSampleActor.class, scheduler, 60000);
    act4.test(65536, scheduler);
    Thread.sleep(200);
    Assert.assertTrue(errors.get() == 0);
}
Also used : SimpleScheduler(org.nustaq.kontraktor.impl.SimpleScheduler) Test(org.junit.Test)

Aggregations

SimpleScheduler (org.nustaq.kontraktor.impl.SimpleScheduler)3 Local (org.nustaq.kontraktor.annotations.Local)2 Test (org.junit.Test)1