Package org.jboss.as.clustering.web

Examples of org.jboss.as.clustering.web.BatchingManager


     *
     * @param session the session. Cannot be <code>null</code>.
     */
    private void processSessionRepl(ClusteredSession<O> session) {
        boolean endBatch = false;
        BatchingManager batchingManager = this.distributedCacheManager.getBatchingManager();
        try {
            // We need transaction so all the replication are sent in batch.
            // Don't do anything if there is already transaction context
            // associated with this thread.
            if (!batchingManager.isBatchInProgress()) {
                batchingManager.startBatch();
                endBatch = true;
            }

            session.processSessionReplication();
        } catch (Exception ex) {
            log.debug("processSessionRepl(): failed with exception", ex);

            RuntimeException exception = null;
            try {
                batchingManager.setBatchRollbackOnly();
            } catch (RuntimeException e) {
                exception = e;
            } catch (Exception e) {
                exception = MESSAGES.failedSessionReplication(e);
            }
            if (exception != null) {
                log.error(MESSAGES.exceptionRollingBackTransaction(), exception);
                throw exception;
            }
        } finally {
            if (endBatch) {
                batchingManager.endBatch();
            }
        }
    }
View Full Code Here


     *
     * @param session the session. Cannot be <code>null</code>.
     */
    private void processSessionRepl(ClusteredSession<O> session) {
        boolean endBatch = false;
        BatchingManager batchingManager = this.distributedCacheManager.getBatchingManager();
        try {
            // We need transaction so all the replication are sent in batch.
            // Don't do anything if there is already transaction context
            // associated with this thread.
            if (!batchingManager.isBatchInProgress()) {
                batchingManager.startBatch();
                endBatch = true;
            }

            session.processSessionReplication();
        } catch (Exception ex) {
            log.debug("processSessionRepl(): failed with exception", ex);

            RuntimeException exception = null;
            try {
                batchingManager.setBatchRollbackOnly();
            } catch (RuntimeException e) {
                exception = e;
            } catch (Exception e) {
                exception = MESSAGES.failedSessionReplication(e);
            }
            if (exception != null) {
                log.error(MESSAGES.exceptionRollingBackTransaction(), exception);
                throw exception;
            }
        } finally {
            if (endBatch) {
                batchingManager.endBatch();
            }
        }
    }
View Full Code Here

        AdvancedCache<SessionKeyImpl, Map<Object, Object>> sessionCache = this.sessionCacheSource.<SessionKeyImpl, Map<Object, Object>>getCache(registry, manager).getAdvancedCache().with(this.getClass().getClassLoader());
        if (!sessionCache.getConfiguration().isInvocationBatchingEnabled()) {
            throw new ClusteringNotSupportedException(String.format("Failed to configure web application for <distributable/> sessions.  %s.%s cache requires batching=\"true\".", sessionCache.getCacheManager().getGlobalConfiguration().getCacheManagerName(), sessionCache.getName()));
        }
        SharedLocalYieldingClusterLockManager lockManager = this.lockManagerSource.getLockManager(sessionCache);
        BatchingManager batchingManager = new TransactionBatchingManager(sessionCache.getTransactionManager());
        SessionAttributeStorage<T> storage = this.storageFactory.createStorage(manager.getReplicationConfig().getReplicationGranularity(), this.marshallerFactory.createMarshaller(manager));

        return new DistributedCacheManager<T, SessionKeyImpl>(registry, manager, new AtomicMapCache<SessionKeyImpl, Object, Object>(sessionCache), this.jvmRouteCacheSource, lockManager, storage, batchingManager, new SessionKeyFactoryImpl(manager), this.invoker);
    }
View Full Code Here

     *
     * @param session the session. Cannot be <code>null</code>.
     */
    private void processSessionRepl(ClusteredSession<O> session) {
        boolean endBatch = false;
        BatchingManager batchingManager = this.distributedCacheManager.getBatchingManager();
        try {
            // We need transaction so all the replication are sent in batch.
            // Don't do anything if there is already transaction context
            // associated with this thread.
            if (!batchingManager.isBatchInProgress()) {
                batchingManager.startBatch();
                endBatch = true;
            }

            session.processSessionReplication();
        } catch (Exception ex) {
            log.debug("processSessionRepl(): failed with exception", ex);

            RuntimeException exception = null;
            try {
                batchingManager.setBatchRollbackOnly();
            } catch (RuntimeException e) {
                exception = e;
            } catch (Exception e) {
                exception = MESSAGES.failedSessionReplication(e);
            }
            if (exception != null) {
                log.error(MESSAGES.exceptionRollingBackTransaction(), exception);
                throw exception;
            }
        } finally {
            if (endBatch) {
                batchingManager.endBatch();
            }
        }
    }
View Full Code Here

        ConfigurationBuilder builder = new ConfigurationBuilder().read(config);
        builder.storeAsBinary().enable().storeKeysAsBinary(false).storeValuesAsBinary(true);
        container.defineConfiguration(name, builder.build());

        AdvancedCache<String, Map<Object, Object>> sessionCache = container.<String, Map<Object, Object>>getCache(name).getAdvancedCache().with(this.getClass().getClassLoader());
        BatchingManager batchingManager = new TransactionBatchingManager(sessionCache.getTransactionManager());
        SessionAttributeStorage<T> storage = this.storageFactory.createStorage(manager.getReplicationConfig().getReplicationGranularity(), this.marshallerFactory.createMarshaller(manager));

        return new DistributedCacheManager<T>(manager, new AtomicMapCache<String, Object, Object>(sessionCache), jvmRouteRegistry, this.lockManager.getOptionalValue(), storage, batchingManager, this.invoker);
    }
View Full Code Here

        ConfigurationBuilder builder = new ConfigurationBuilder().read(config);
        builder.storeAsBinary().enable().storeKeysAsBinary(false).storeValuesAsBinary(true);
        container.defineConfiguration(name, builder.build());

        AdvancedCache<String, Map<Object, Object>> sessionCache = container.<String, Map<Object, Object>>getCache(name).getAdvancedCache().with(this.getClass().getClassLoader());
        BatchingManager batchingManager = new TransactionBatchingManager(sessionCache.getTransactionManager());
        SessionAttributeStorage<T> storage = this.storageFactory.createStorage(manager.getReplicationConfig().getReplicationGranularity(), this.marshallerFactory.createMarshaller(manager));

        return new DistributedCacheManager<T>(manager, new AtomicMapCache<String, Object, Object>(sessionCache), jvmRouteRegistry, this.lockManager.getOptionalValue(), storage, batchingManager, this.invoker);
    }
View Full Code Here

        AdvancedCache<SessionKeyImpl, Map<Object, Object>> sessionCache = this.sessionCacheSource.<SessionKeyImpl, Map<Object, Object>>getCache(registry, manager).getAdvancedCache().with(this.getClass().getClassLoader());
        if (!sessionCache.getConfiguration().isInvocationBatchingEnabled()) {
            throw new ClusteringNotSupportedException(MESSAGES.failedToConfigureWebApp(sessionCache.getCacheManager().getGlobalConfiguration().getCacheManagerName(), sessionCache.getName()));
        }
        SharedLocalYieldingClusterLockManager lockManager = this.lockManagerSource.getLockManager(sessionCache);
        BatchingManager batchingManager = new TransactionBatchingManager(sessionCache.getTransactionManager());
        SessionAttributeStorage<T> storage = this.storageFactory.createStorage(manager.getReplicationConfig().getReplicationGranularity(), this.marshallerFactory.createMarshaller(manager));

        return new DistributedCacheManager<T, SessionKeyImpl>(registry, manager, new AtomicMapCache<SessionKeyImpl, Object, Object>(sessionCache), this.jvmRouteCacheSource, lockManager, storage, batchingManager, new SessionKeyFactoryImpl(manager), this.invoker);
    }
View Full Code Here

TOP

Related Classes of org.jboss.as.clustering.web.BatchingManager

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.