Package org.wildfly.clustering.ee

Examples of org.wildfly.clustering.ee.Batch


    @Test
    public void createSingleSignOn() {
        String id = "sso";
        Batcher<Batch> batcher = mock(Batcher.class);
        Batch batch = mock(Batch.class);
        Account account = mock(Account.class);
        String mechanism = HttpServletRequest.BASIC_AUTH;
        SSO<AuthenticatedSession, String, Void> sso = mock(SSO.class);
        ArgumentCaptor<AuthenticatedSession> authenticationCaptor = ArgumentCaptor.forClass(AuthenticatedSession.class);
View Full Code Here


    @Test
    public void findSingleSignOn() {
        String id = "sso";
        Batcher<Batch> batcher = mock(Batcher.class);
        Batch batch = mock(Batch.class);

        when(this.manager.getBatcher()).thenReturn(batcher);
        when(batcher.createBatch()).thenReturn(batch);
        when(this.manager.findSSO(id)).thenReturn(null);
View Full Code Here

    @Test
    public void removeSingleSignOn() {
        String id = "sso";
        Batcher<Batch> batcher = mock(Batcher.class);
        Batch batch = mock(Batch.class);

        when(this.manager.getBatcher()).thenReturn(batcher);
        when(batcher.createBatch()).thenReturn(batch);
        when(this.manager.findSSO(id)).thenReturn(null);
View Full Code Here

        @Override
        public void run() {
            InfinispanWebLogger.ROOT_LOGGER.tracef("Expiring session %s", this.id);
            try {
                Batch batch = SessionExpirationScheduler.this.batcher.createBatch();
                boolean success = false;
                try {
                    SessionExpirationScheduler.this.remover.remove(this.id);
                    success = true;
                } catch (Throwable e) {
                    InfinispanWebLogger.ROOT_LOGGER.failedToExpireSession(e, this.id);
                } finally {
                    if (success) {
                        batch.close();
                    } else {
                        batch.discard();
                    }
                }
            } finally {
                synchronized (this) {
                    SessionExpirationScheduler.this.expirationFutures.remove(this.id);
View Full Code Here

            for (CacheEntry<String, ?> entry : entries.converter(NullValueConverter.getInstance())) {
                String sessionId = entry.getKey();
                // If we are the new primary owner of this session
                // then schedule expiration of this session locally
                if (!oldLocality.isLocal(sessionId) && newLocality.isLocal(sessionId)) {
                    Batch batch = this.batcher.createBatch();
                    try {
                        // We need to lookup the session to obtain its meta data
                        V value = this.factory.findValue(sessionId);
                        if (value != null) {
                            ImmutableSession session = this.factory.createImmutableSession(sessionId, value);
                            this.scheduler.schedule(session);
                        }
                    } finally {
                        batch.discard();
                    }
                }
            }
        }
    }
View Full Code Here

            } while (this.manager.containsSession(id));

            config.setSessionId(exchange, id);
        }

        Batch batch = this.manager.getBatcher().createBatch();
        try {
            Session<LocalSessionContext> session = this.manager.createSession(id);
            io.undertow.server.session.Session adapter = new DistributableSession(this, session, config, batch);
            this.sessionListeners.sessionCreated(adapter, exchange);
            return adapter;
        } catch (RuntimeException | Error e) {
            batch.discard();
            throw e;
        }
    }
View Full Code Here

    @Override
    public io.undertow.server.session.Session getSession(HttpServerExchange exchange, SessionConfig config) {
        String id = config.findSessionId(exchange);
        if (id == null) return null;

        Batch batch = this.manager.getBatcher().createBatch();
        try {
            Session<LocalSessionContext> session = this.manager.findSession(id);
            if (session == null) {
                batch.discard();
                return null;
            }
            return new DistributableSession(this, session, config, batch);
        } catch (RuntimeException | Error e) {
            batch.discard();
            throw e;
        }
    }
View Full Code Here

        return this.manager.getLocalSessions();
    }

    @Override
    public io.undertow.server.session.Session getSession(String sessionId) {
        Batch batch = this.manager.getBatcher().createBatch();
        try {
            ImmutableSession session = this.manager.viewSession(sessionId);
            return (session != null) ? new DistributableImmutableSession(this, session) : null;
        } finally {
            batch.discard();
        }
    }
View Full Code Here

    @Test
    public void createSessionNoSessionId() {
        HttpServerExchange exchange = new HttpServerExchange(null);
        Batcher<Batch> batcher = mock(Batcher.class);
        Batch batch = mock(Batch.class);
        SessionConfig config = mock(SessionConfig.class);
        Session<LocalSessionContext> session = mock(Session.class);
        String sessionId = "session";
        String existingSessionId = "existing";
       
View Full Code Here

    @Test
    public void createSessionSpecifiedSessionId() {
        HttpServerExchange exchange = new HttpServerExchange(null);
        Batcher<Batch> batcher = mock(Batcher.class);
        Batch batch = mock(Batch.class);
        SessionConfig config = mock(SessionConfig.class);
        Session<LocalSessionContext> session = mock(Session.class);
        String sessionId = "session";
       
        when(config.findSessionId(exchange)).thenReturn(sessionId);
View Full Code Here

TOP

Related Classes of org.wildfly.clustering.ee.Batch

Copyright © 2018 www.massapicom. 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.