Package org.jboss.util.loading.ContextClassLoaderSwitcher

Examples of org.jboss.util.loading.ContextClassLoaderSwitcher.SwitchContext


     
      @Override
      protected void setStateInternal(InputStream is) throws IOException, ClassNotFoundException
      {
         ClassLoader cl = getStateTransferClassLoader();
         SwitchContext switchContext = CoreGroupCommunicationService.this.classLoaderSwitcher.getSwitchContext(cl);
         try
         {
            MarshalledValueInputStream mvis = new MarshalledValueInputStream(is);
            this.state = (Serializable) mvis.readObject();
         }
         finally
         {
            switchContext.reset();
         }
      }
View Full Code Here


      }
     
      protected void setStateInternal(InputStream is) throws IOException, ClassNotFoundException
      {
         ClassLoader cl = getStateTransferClassLoader();
         SwitchContext switchContext = CoreGroupCommunicationService.this.classLoaderSwitcher.getSwitchContext(cl);
         try
         {
            MarshalledValueInputStream mvis = new MarshalledValueInputStream(is);
            this.state = (Serializable) mvis.readObject();
         }
         finally
         {
            switchContext.reset();
         }
      }
View Full Code Here

     * {@inheritDoc}
     * @see org.infinispan.manager.EmbeddedCacheManager#getCache(java.lang.String, boolean)
     */
    @Override
    public <K, V> Cache<K, V> getCache(String cacheName, boolean start) {
        SwitchContext context = start ? switcher.getSwitchContext(DefaultEmbeddedCacheManager.class.getClassLoader()) : null;
        try {
            Cache<K, V> cache = this.container.<K, V>getCache(this.getCacheName(cacheName), start);
            return (cache != null) ? new DelegatingCache<K, V>(cache) : null;
        } finally {
            if (context != null) {
                context.reset();
            }
        }
    }
View Full Code Here

     * {@inheritDoc}
     * @see org.infinispan.manager.EmbeddedCacheManager#getCache(java.lang.String, boolean)
     */
    @Override
    public <K, V> Cache<K, V> getCache(String cacheName, boolean start) {
        SwitchContext context = start ? switcher.getSwitchContext(DefaultEmbeddedCacheManager.class.getClassLoader()) : null;
        try {
            Cache<K, V> cache = this.container.<K, V>getCache(this.getCacheName(cacheName), start);
            return (cache != null) ? new DelegatingCache<K, V>(cache) : null;
        } finally {
            if (context != null) {
                context.reset();
            }
        }
    }
View Full Code Here

      this.passivatedCount.decrementAndGet();
      this.resetTotalSize.set(true);
     
      if (localActivity.get() == Boolean.TRUE)
      {
         SwitchContext switchContext = switcher.getSwitchContext();
         ClassLoader classLoader = this.classLoaderRef.get();
        
         try
         {
            if (classLoader != null)
            {
               switchContext.setClassLoader(classLoader);
            }
  
            bean.activateAfterReplication();
         }
         finally
         {
            if (classLoader != null)
            {
               switchContext.reset();
            }
         }
      }
   }
View Full Code Here

      Object key = event.getKey();
      this.trace("passivated(%s)", key);
     
      StatefulBeanContext bean = event.getValue();
     
      SwitchContext switchContext = switcher.getSwitchContext();
      ClassLoader classLoader = this.classLoaderRef.get();
     
      Boolean active = localActivity.get();
      localActivity.set(Boolean.TRUE);
     
      try
      {
         if (!bean.getCanPassivate())
         {
            // Abort the eviction
            throw new RuntimeException(String.format("Cannot passivate bean %s -- it or one if its children is currently in use", key));
         }
        
         this.passivatedCount.incrementAndGet();
         this.resetTotalSize.set(true);
        
         if (classLoader != null)
         {
            switchContext.setClassLoader(classLoader);
         }
        
         bean.passivateAfterReplication();
      }
      finally
      {
         localActivity.set(active);
        
         if (classLoader != null)
         {
            switchContext.reset();
         }
      }
   }
View Full Code Here

        }

        @Override
        protected void setStateInternal(InputStream is) throws IOException, ClassNotFoundException {
            ClassLoader cl = getStateTransferClassLoader();
            SwitchContext switchContext = CoreGroupCommunicationService.this.classLoaderSwitcher.getSwitchContext(cl);
            try {
                MarshalledValueInputStream mvis = new MarshalledValueInputStream(is);
                this.state = (Serializable) mvis.readObject();
            } finally {
                switchContext.reset();
            }
        }
View Full Code Here

     
      @Override
      protected void setStateInternal(InputStream is) throws IOException, ClassNotFoundException
      {
         ClassLoader cl = getStateTransferClassLoader();
         SwitchContext switchContext = CoreGroupCommunicationService.this.classLoaderSwitcher.getSwitchContext(cl);
         try
         {
            MarshalledValueInputStream mvis = new MarshalledValueInputStream(is);
            this.state = (Serializable) mvis.readObject();
         }
         finally
         {
            switchContext.reset();
         }
      }
View Full Code Here

     * {@inheritDoc}
     * @see org.infinispan.manager.EmbeddedCacheManager#getCache(java.lang.String, boolean)
     */
    @Override
    public <K, V> Cache<K, V> getCache(String cacheName, boolean start) {
        SwitchContext context = start ? switcher.getSwitchContext(DefaultEmbeddedCacheManager.class.getClassLoader()) : null;
        try {
            Cache<K, V> cache = this.container.<K, V>getCache(this.getCacheName(cacheName), start);
            return (cache != null) ? new DelegatingCache<K, V>(cache) : null;
        } finally {
            if (context != null) {
                context.reset();
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.util.loading.ContextClassLoaderSwitcher.SwitchContext

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.