Package org.jboss.cache.interceptors

Examples of org.jboss.cache.interceptors.Interceptor



        TreeCache cache = createReplicatedCache(TreeCache.REPL_SYNC);


        Interceptor txInterceptor = new TxInterceptor();
        txInterceptor.setCache(cache);
        Interceptor replicationInterceptor = new OptimisticReplicationInterceptor();
        replicationInterceptor.setCache(cache);
        Interceptor createInterceptor = new OptimisticCreateIfNotExistsInterceptor();
        createInterceptor.setCache(cache);
        OptimisticNodeInterceptor nodeInterceptor = new OptimisticNodeInterceptor();
        nodeInterceptor.setCache(cache);
        MockInterceptor dummy = new MockInterceptor();
        dummy.setCache(cache);

        txInterceptor.setNext(replicationInterceptor);
        replicationInterceptor.setNext(createInterceptor);
        createInterceptor.setNext(nodeInterceptor);
        nodeInterceptor.setNext(dummy);

        cache.setInterceptorChain(txInterceptor);


        TreeCache cache2 = createReplicatedCache(TreeCache.REPL_SYNC);


        Interceptor txInterceptor2 = new TxInterceptor();
        txInterceptor2.setCache(cache2);
        Interceptor replicationInterceptor2 = new OptimisticReplicationInterceptor();
        replicationInterceptor2.setCache(cache2);
        Interceptor createInterceptor2 = new OptimisticCreateIfNotExistsInterceptor();
        createInterceptor2.setCache(cache2);
        OptimisticNodeInterceptor nodeInterceptor2 = new OptimisticNodeInterceptor();
        nodeInterceptor2.setCache(cache2);
        MockInterceptor dummy2 = new MockInterceptor();
        dummy2.setCache(cache2);

        txInterceptor2.setNext(replicationInterceptor2);
        replicationInterceptor2.setNext(createInterceptor2);
        createInterceptor2.setNext(nodeInterceptor2);
        nodeInterceptor2.setNext(dummy2);

        cache2.setInterceptorChain(txInterceptor2);

View Full Code Here



        TreeCache cache = createReplicatedCache(TreeCache.REPL_SYNC);


        Interceptor txInterceptor = new TxInterceptor();
        txInterceptor.setCache(cache);
        Interceptor replicationInterceptor = new OptimisticReplicationInterceptor();
        replicationInterceptor.setCache(cache);
        Interceptor createInterceptor = new OptimisticCreateIfNotExistsInterceptor();
        createInterceptor.setCache(cache);
        OptimisticNodeInterceptor nodeInterceptor = new OptimisticNodeInterceptor();
        nodeInterceptor.setCache(cache);
        MockInterceptor dummy = new MockInterceptor();
        dummy.setCache(cache);

        txInterceptor.setNext(replicationInterceptor);
        replicationInterceptor.setNext(createInterceptor);
        createInterceptor.setNext(nodeInterceptor);
        nodeInterceptor.setNext(dummy);

        cache.setInterceptorChain(txInterceptor);


        TreeCache cache2 = createReplicatedCache(TreeCache.REPL_SYNC);


        Interceptor txInterceptor2 = new TxInterceptor();
        txInterceptor2.setCache(cache2);
        Interceptor replicationInterceptor2 = new OptimisticReplicationInterceptor();
        replicationInterceptor2.setCache(cache2);
        Interceptor createInterceptor2 = new OptimisticCreateIfNotExistsInterceptor();
        createInterceptor2.setCache(cache2);
        OptimisticNodeInterceptor nodeInterceptor2 = new OptimisticNodeInterceptor();
        nodeInterceptor2.setCache(cache2);
        MockFailureInterceptor dummy2 = new MockFailureInterceptor();
        List failures = new ArrayList();
        failures.add(MethodDeclarations.optimisticPrepareMethod);
        dummy2.setFailurelist(failures);
        dummy2.setCache(cache2);

        txInterceptor2.setNext(replicationInterceptor2);
        replicationInterceptor2.setNext(createInterceptor2);
        createInterceptor2.setNext(nodeInterceptor2);
        nodeInterceptor2.setNext(dummy2);

        cache2.setInterceptorChain(txInterceptor2);

View Full Code Here


        TreeCache cache = createReplicatedCache(TreeCache.REPL_SYNC);


        Interceptor txInterceptor = new TxInterceptor();
        txInterceptor.setCache(cache);
        Interceptor replicationInterceptor = new OptimisticReplicationInterceptor();
        replicationInterceptor.setCache(cache);
        Interceptor createInterceptor = new OptimisticCreateIfNotExistsInterceptor();
        createInterceptor.setCache(cache);
        OptimisticNodeInterceptor nodeInterceptor = new OptimisticNodeInterceptor();
        nodeInterceptor.setCache(cache);

        MockFailureInterceptor dummy = new MockFailureInterceptor();
        List failures = new ArrayList();
        failures.add(MethodDeclarations.optimisticPrepareMethod);
        dummy.setFailurelist(failures);
        dummy.setCache(cache);

        txInterceptor.setNext(replicationInterceptor);
        replicationInterceptor.setNext(createInterceptor);
        createInterceptor.setNext(nodeInterceptor);
        nodeInterceptor.setNext(dummy);

        cache.setInterceptorChain(txInterceptor);


        TreeCache cache2 = createReplicatedCache(TreeCache.REPL_SYNC);


        Interceptor txInterceptor2 = new TxInterceptor();
        txInterceptor2.setCache(cache2);
        Interceptor replicationInterceptor2 = new OptimisticReplicationInterceptor();
        replicationInterceptor2.setCache(cache2);
        Interceptor createInterceptor2 = new OptimisticCreateIfNotExistsInterceptor();
        createInterceptor2.setCache(cache2);
        OptimisticNodeInterceptor nodeInterceptor2 = new OptimisticNodeInterceptor();
        nodeInterceptor2.setCache(cache2);

        MockInterceptor dummy2 = new MockInterceptor();
        dummy2.setCache(cache2);


        txInterceptor2.setNext(replicationInterceptor2);
        replicationInterceptor2.setNext(createInterceptor2);
        createInterceptor2.setNext(nodeInterceptor2);
        nodeInterceptor2.setNext(dummy2);

        cache2.setInterceptorChain(txInterceptor2);

View Full Code Here

    public void testLocalTransaction() throws Exception
    {

        TreeCache cache = createCacheWithListener();

        Interceptor txInterceptor = new TxInterceptor();
        txInterceptor.setCache(cache);
        Interceptor replicationInterceptor = new OptimisticReplicationInterceptor();
        replicationInterceptor.setCache(cache);
        Interceptor createInterceptor = new OptimisticCreateIfNotExistsInterceptor();
        createInterceptor.setCache(cache);
        Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
        nodeInterceptor.setCache(cache);
        MockInterceptor dummy = new MockInterceptor();
        dummy.setCache(cache);

        txInterceptor.setNext(replicationInterceptor);
        replicationInterceptor.setNext(createInterceptor);
        createInterceptor.setNext(nodeInterceptor);
        nodeInterceptor.setNext(dummy);

        cache.setInterceptorChain(txInterceptor);

        DummyTransactionManager mgr = DummyTransactionManager.getInstance();
        assertNull(mgr.getTransaction());
View Full Code Here

    public void testRollbackTransaction() throws Exception
    {

        TreeCache cache = createCacheWithListener();

        Interceptor txInterceptor = new TxInterceptor();
        txInterceptor.setCache(cache);
        Interceptor replicationInterceptor = new OptimisticReplicationInterceptor();
        replicationInterceptor.setCache(cache);
        Interceptor createInterceptor = new OptimisticCreateIfNotExistsInterceptor();
        createInterceptor.setCache(cache);
        Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
        nodeInterceptor.setCache(cache);
        MockInterceptor dummy = new MockInterceptor();
        dummy.setCache(cache);

        txInterceptor.setNext(replicationInterceptor);
        replicationInterceptor.setNext(createInterceptor);
        createInterceptor.setNext(nodeInterceptor);
        nodeInterceptor.setNext(dummy);
        cache.setInterceptorChain(txInterceptor);

        DummyTransactionManager mgr = DummyTransactionManager.getInstance();
        assertNull(mgr.getTransaction());
        assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
View Full Code Here

    public void testRemotePrepareTransaction() throws Exception
    {

        TreeCache cache = createCacheWithListener();

        Interceptor txInterceptor = new TxInterceptor();
        txInterceptor.setCache(cache);
        Interceptor replicationInterceptor = new OptimisticReplicationInterceptor();
        replicationInterceptor.setCache(cache);
        Interceptor createInterceptor = new OptimisticCreateIfNotExistsInterceptor();
        createInterceptor.setCache(cache);
        Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
        nodeInterceptor.setCache(cache);
        MockInterceptor dummy = new MockInterceptor();
        dummy.setCache(cache);

        txInterceptor.setNext(replicationInterceptor);
        replicationInterceptor.setNext(createInterceptor);
        createInterceptor.setNext(nodeInterceptor);
        nodeInterceptor.setNext(dummy);

        cache.setInterceptorChain(txInterceptor);
        DummyTransactionManager mgr = DummyTransactionManager.getInstance();

        //start local transaction
View Full Code Here

   {
      cache = createCache();
      lri = new LockReportInterceptor();
      lri.setCache(cache);

      Interceptor i = (Interceptor) cache.getInterceptors().get(0);
      Interceptor lockInterceptor = i;
      // find the OptimisticLockInterceptor and insert LockReportInterceptor after that.
      while (!(lockInterceptor instanceof OptimisticLockingInterceptor)) lockInterceptor = lockInterceptor.getNext();
      Interceptor next = lockInterceptor.getNext();

      lockInterceptor.setNext(lri);
      lri.setNext(next);

      cache.setInterceptorChain(i);
View Full Code Here

    {

        TestListener listener = new TestListener();
        final TreeCache cache = createCacheWithListener(listener);

        Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
        interceptor.setCache(cache);
        Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
        nodeInterceptor.setCache(cache);
        MockInterceptor dummy = new MockInterceptor();
        dummy.setCache(cache);

        interceptor.setNext(nodeInterceptor);
        nodeInterceptor.setNext(dummy);

        cache.setInterceptorChain(interceptor);

//     first set up a node with a pojo
        DummyTransactionManager mgr = DummyTransactionManager.getInstance();
View Full Code Here

    {

        TestListener listener = new TestListener();
        final TreeCache cache = createCacheWithListener(listener);

        Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
        interceptor.setCache(cache);
        Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
        nodeInterceptor.setCache(cache);
        MockInterceptor dummy = new MockInterceptor();
        dummy.setCache(cache);

        interceptor.setNext(nodeInterceptor);
        nodeInterceptor.setNext(dummy);

        cache.setInterceptorChain(interceptor);

//     first set up a node with a pojo
        DummyTransactionManager mgr = DummyTransactionManager.getInstance();
View Full Code Here

    {

        TestListener listener = new TestListener();
        final TreeCache cache = createCacheWithListener(listener);

        Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
        interceptor.setCache(cache);
        Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
        nodeInterceptor.setCache(cache);
        MockInterceptor dummy = new MockInterceptor();
        dummy.setCache(cache);

        interceptor.setNext(nodeInterceptor);
        nodeInterceptor.setNext(dummy);

        cache.setInterceptorChain(interceptor);

//     first set up a node with a pojo
        DummyTransactionManager mgr = DummyTransactionManager.getInstance();
View Full Code Here

TOP

Related Classes of org.jboss.cache.interceptors.Interceptor

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.