Search in sources :

Example 41 with BatchContext

use of org.wildfly.clustering.ee.BatchContext in project wildfly by wildfly.

the class DistributableSession method getCreationTime.

@Override
public long getCreationTime() {
    Session<LocalSessionContext> session = this.entry.getKey();
    validate(session);
    try (BatchContext context = this.manager.getSessionManager().getBatcher().resumeBatch(this.batch)) {
        return session.getMetaData().getCreationTime().toEpochMilli();
    }
}
Also used : BatchContext(org.wildfly.clustering.ee.BatchContext)

Example 42 with BatchContext

use of org.wildfly.clustering.ee.BatchContext in project wildfly by wildfly.

the class InfinispanBatcherTestCase method resumeNullBatch.

@Test
public void resumeNullBatch() throws Exception {
    TransactionBatch batch = mock(TransactionBatch.class);
    InfinispanBatcher.CURRENT_BATCH.set(batch);
    try (BatchContext context = this.batcher.resumeBatch(null)) {
        verifyZeroInteractions(this.tm);
        assertNull(InfinispanBatcher.CURRENT_BATCH.get());
    }
    verifyZeroInteractions(this.tm);
    assertSame(batch, InfinispanBatcher.CURRENT_BATCH.get());
}
Also used : BatchContext(org.wildfly.clustering.ee.BatchContext) Test(org.junit.Test)

Aggregations

BatchContext (org.wildfly.clustering.ee.BatchContext)42 Test (org.junit.Test)30 Batch (org.wildfly.clustering.ee.Batch)19 AuthenticatedSession (io.undertow.security.api.AuthenticatedSessionManager.AuthenticatedSession)15 SessionAttributes (org.wildfly.clustering.web.session.SessionAttributes)11 SessionListeners (io.undertow.server.session.SessionListeners)9 SessionListener (io.undertow.server.session.SessionListener)8 Session (io.undertow.server.session.Session)6 SessionManager (io.undertow.server.session.SessionManager)6 HttpServerExchange (io.undertow.server.HttpServerExchange)5 SessionMetaData (org.wildfly.clustering.web.session.SessionMetaData)5 Account (io.undertow.security.idm.Account)4 Instant (java.time.Instant)3 SessionConfig (io.undertow.server.session.SessionConfig)2 CachedAuthenticatedSessionHandler (io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler)2 Transaction (javax.transaction.Transaction)2 DeploymentInfo (io.undertow.servlet.api.DeploymentInfo)1 ThreadSetupHandler (io.undertow.servlet.api.ThreadSetupHandler)1 Duration (java.time.Duration)1 ArrayList (java.util.ArrayList)1