Package org.jboss.cache.interceptors

Examples of org.jboss.cache.interceptors.Interceptor


    public void testTransactionValidateRollbackMethod() throws Exception
    {

        TreeCache cache = createCacheWithListener();
        Interceptor validateInterceptor = new OptimisticValidatorInterceptor();
        validateInterceptor.setCache(cache);
        Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
        interceptor.setCache(cache);
        Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
        nodeInterceptor.setCache(cache);
        MockInterceptor dummy = new MockInterceptor();
        dummy.setCache(cache);
        validateInterceptor.setNext(interceptor);
        interceptor.setNext(nodeInterceptor);
        nodeInterceptor.setNext(dummy);

        cache.setInterceptorChain(validateInterceptor);

//     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

    private BlockingInterceptor insertBlockingInterceptor(TreeCache cache)
    {
       BlockingInterceptor interceptor = new BlockingInterceptor();
      
       List interceptors = cache.getInterceptors();
       Interceptor first = (Interceptor) interceptors.get(0);
       Interceptor next = first.getNext();
      
       interceptor.setNext(next);
       first.setNext(interceptor);
      
       return interceptor;
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);

        try
        {
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);

        boolean fail = false;
        try
View Full Code Here

   {
      if (server == null || cache == null)
         return;
     
      List interceptors = cache.getInterceptors();
      Interceptor interceptor = null;
     
      // get the cache's registration name
      String tmpName = cache.getServiceName() != null? cache.getServiceName().toString() : null;
      if(tmpName == null)
      {        
         tmpName = PREFIX + cache.getClusterName();
         if(cache.getClusterName() == null)
            tmpName = PREFIX + cache.getClass().getName() + System.currentTimeMillis();
      }
      // register the cache
      if (registerCache)
      {
         ObjectName tmpObj = new ObjectName(tmpName);
         if (!server.isRegistered(tmpObj))
         {
            // under some circumstances, this block may be executed on WebSphere when the name is already registered
            try
            {
               server.registerMBean(cache, tmpObj);
            }
            catch (Exception e)
            {
               LOG.warn("mbean registration failed for " + tmpObj.getCanonicalName() + "; " + e.toString());
            }
         }
         else
         {
            LOG.warn("mbean " + tmpObj.getCanonicalName() + " already registered");
         }
      }

      for(int i = 0; i < interceptors.size(); i++)
      {
         interceptor =(Interceptor)interceptors.get(i);
         boolean mbeanExists = true;
         try
         {
            // the mbean for interceptor AbcInterceptor will be named AbcInterceptorMBean
            Class.forName(interceptor.getClass().getName()+ MBEAN_CLASS_SUFFIX);
         }
         catch(Throwable e)
         {
            // if the class can't be instantiated, no mbean is available
            mbeanExists = false;
         }

         // for JDK 1.4, must parse name and remove package prefix
         // for JDK 1.5, can use getSimpleName() to establish class name without package prefix
         String className = interceptor.getClass().getName();
         String serviceName = tmpName + MBEAN_KEY + className.substring(className.lastIndexOf('.')+1);
        
         ObjectName objName = new ObjectName(serviceName);
         if (!server.isRegistered(objName))
         {
View Full Code Here

   {
      if (server == null || cache == null)
         return;
     
      List interceptors = cache.getInterceptors();
      Interceptor interceptor = null;
     
      // get the cache's registration name
      String tmpName = cache.getServiceName() != null? cache.getServiceName().toString() : null;
      if(tmpName == null)
      {        
         tmpName = PREFIX + cache.getClusterName();
         if(cache.getClusterName() == null)
            tmpName = PREFIX + cache.getClass().getName() + System.currentTimeMillis();
      }

      for(int i = 0; i < interceptors.size(); i++)
      {
         interceptor =(Interceptor)interceptors.get(i);

         // for JDK 1.4, must parse name and remove package prefix
         // for JDK 1.5, can use getSimpleName() to establish class name without package prefix
         String className = interceptor.getClass().getName();
         String serviceName = tmpName + MBEAN_KEY + className.substring(className.lastIndexOf('.')+1);
        
         ObjectName objName = new ObjectName(serviceName);
         if (server.isRegistered(objName))
            try
View Full Code Here

    {
        Iterator ints = cache.getInterceptors().iterator();
        CacheStoreInterceptor csi = null;
        while (ints.hasNext())
        {
            Interceptor i = (Interceptor) ints.next();
            if (i instanceof CacheStoreInterceptor)
            {
                csi = (CacheStoreInterceptor) i;
                break;
            }
View Full Code Here

    {

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

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

        interceptor.setNext(dummy);

        cache.setInterceptorChain(interceptor);

        setupTransactionsInInvocationCtx(cache);
View Full Code Here

    {

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

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

        interceptor.setNext(dummy);


        cache.setInterceptorChain(interceptor);

        setupTransactionsInInvocationCtx(cache);
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.