Examples of BatchingManager


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

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

        if (!cache.getCacheConfiguration().invocationBatching().enabled()) {
            ServiceName cacheServiceName = this.getCacheServiceName(manager.getReplicationConfig());
            throw new ClusteringNotSupportedException(MESSAGES.failedToConfigureWebApp(cacheServiceName.getParent().getSimpleName(), cacheServiceName.getSimpleName()));
        }

        BatchingManager batchingManager = new TransactionBatchingManager(cache.getTransactionManager());
        SessionAttributeStorage<T> storage = this.storageFactory.createStorage(manager.getReplicationConfig().getReplicationGranularity(), this.marshallerFactory.createMarshaller(manager));

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

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 = new RuntimeException("JBossCacheManager.processSessionRepl(): failed to replicate session.", e);
            }
            if (exception != null) {
                log.error("Caught exception rolling back transaction", exception);
                throw exception;
            }
        } finally {
            if (endBatch) {
                batchingManager.endBatch();
            }
        }
    }
View Full Code Here

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

    private void processSessionRepl(ClusteredSession<O> session) {
        // If we are using SESSION granularity, we don't want to initiate a TX
        // for a single put
        boolean notSession = (this.getReplicationGranularity() != ReplicationGranularity.SESSION);
        boolean doTx = 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 (notSession && batchingManager.isBatchInProgress() == false) {
                batchingManager.startBatch();
                doTx = true;
            }

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

            try {
                // if(doTx)
                // Let's setRollbackOnly no matter what.
                // (except if there's no tx due to SESSION (JBAS-3840))
                if (notSession)
                    batchingManager.setBatchRollbackOnly();
            } catch (Exception exn) {
                log.error("Caught exception rolling back transaction", exn);
            }

            // We will need to alert Tomcat of this exception.
            if (ex instanceof RuntimeException)
                throw (RuntimeException) ex;

            throw new RuntimeException("JBossCacheManager.processSessionRepl(): failed to replicate session.", ex);
        } finally {
            if (doTx) {
                batchingManager.endBatch();
            }
        }
    }
View Full Code Here

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

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 = new RuntimeException("JBossCacheManager.processSessionRepl(): failed to replicate session.", e);
            }
            if (exception != null) {
                log.error("Caught exception rolling back transaction", exception);
                throw exception;
            }
        } finally {
            if (endBatch) {
                batchingManager.endBatch();
            }
        }
    }
View Full Code Here

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

    private void processSessionRepl(ClusteredSession<O> session) {
        // If we are using SESSION granularity, we don't want to initiate a TX
        // for a single put
        boolean notSession = (this.getReplicationGranularity() != ReplicationGranularity.SESSION);
        boolean doTx = 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 (notSession && batchingManager.isBatchInProgress() == false) {
                batchingManager.startBatch();
                doTx = true;
            }

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

            try {
                // if(doTx)
                // Let's setRollbackOnly no matter what.
                // (except if there's no tx due to SESSION (JBAS-3840))
                if (notSession)
                    batchingManager.setBatchRollbackOnly();
            } catch (Exception exn) {
                log.error("Caught exception rolling back transaction", exn);
            }

            // We will need to alert Tomcat of this exception.
            if (ex instanceof RuntimeException)
                throw (RuntimeException) ex;

            throw new RuntimeException("JBossCacheManager.processSessionRepl(): failed to replicate session.", ex);
        } finally {
            if (doTx) {
                batchingManager.endBatch();
            }
        }
    }
View Full Code Here

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

    @Override
    public <T extends OutgoingDistributableSessionData> org.jboss.as.clustering.web.DistributedCacheManager<T> getDistributedCacheManager(ServiceRegistry registry, LocalDistributableSessionManager manager) {
        Cache<SessionKeyImpl, Map<Object, Object>> sessionCache = this.sessionCacheSource.getCache(registry, manager);
        SharedLocalYieldingClusterLockManager lockManager = this.lockManagerSource.getLockManager(sessionCache);
        BatchingManager batchingManager = new TransactionBatchingManager(sessionCache.getAdvancedCache().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

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

        if (!cache.getCacheConfiguration().invocationBatching().enabled()) {
            ServiceName cacheServiceName = this.getCacheServiceName(manager.getReplicationConfig());
            throw new ClusteringNotSupportedException(MESSAGES.failedToConfigureWebApp(cacheServiceName.getParent().getSimpleName(), cacheServiceName.getSimpleName()));
        }

        BatchingManager batchingManager = new TransactionBatchingManager(cache.getTransactionManager());
        SessionAttributeStorage<T> storage = this.storageFactory.createStorage(manager.getReplicationConfig().getReplicationGranularity(), this.marshallerFactory.createMarshaller(manager));

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

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

        if (!sessionCache.getConfiguration().isInvocationBatchingEnabled()) {
            throw new ClusteringNotSupportedException(MESSAGES.failedToConfigureWebApp(sessionCache.getCacheManager().getGlobalConfiguration().getCacheManagerName(), sessionCache.getName()));
        }
        @SuppressWarnings("unchecked")
        Cache<Address, String> jvmRouteCache = this.sessionCache.getValue();
        BatchingManager batchingManager = new TransactionBatchingManager(sessionCache.getTransactionManager());
        SessionAttributeStorage<T> storage = this.storageFactory.createStorage(manager.getReplicationConfig().getReplicationGranularity(), this.marshallerFactory.createMarshaller(manager));

        return new DistributedCacheManager<T, SessionKeyImpl>(manager, new AtomicMapCache<SessionKeyImpl, Object, Object>(sessionCache), jvmRouteCache, this.lockManager.getValue(), storage, batchingManager, new SessionKeyFactoryImpl(manager), this.invoker);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.