Package org.jboss.cache.factories

Examples of org.jboss.cache.factories.ComponentRegistry


   public void setUp() throws Exception
   {
      listener = new TestListener();
      cache = createCacheWithListener(listener);

      ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);

      Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
      cr.registerComponent(interceptor, OptimisticCreateIfNotExistsInterceptor.class);
      Interceptor nodeInterceptor = new OptimisticNodeInterceptor();
      cr.registerComponent(nodeInterceptor, OptimisticNodeInterceptor.class);
      dummy = new MockInterceptor();
      cr.registerComponent(dummy, MockInterceptor.class);

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

      TestingUtil.replaceInterceptorChain(cache, interceptor);
View Full Code Here


      final CountDownLatch mainThreadCommitLatch = new CountDownLatch(1);
      final CountDownLatch secondThreadPrepareLatch = new CountDownLatch(1);
      final Fqn fqn = Fqn.fromString("/a/b/c");

      DelayingRPCManager delayingRPCManager = new DelayingRPCManager(mainThreadCommitLatch, secondThreadPrepareLatch, syncCommit, noOutOfBandMessages);
      ComponentRegistry cr = TestingUtil.extractComponentRegistry(c1);
      cr.registerComponent(RPCManager.class.getName(), delayingRPCManager, RPCManager.class);

      c1.start();
      c2.start();

      TestingUtil.blockUntilViewsReceived(60000, c1, c2);
View Full Code Here

      // Put the cache in the map before starting, so if it fails in
      // start it can still be destroyed later
      caches.put("secretive", cache);

      // inject our own message listener and re-wire deps
      ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);
//      cr.unregisterComponent(CacheMessageListener.class);
      cr.registerComponent(CacheMessageListener.class.getName(), new SecretiveStateCacheMessageListener(), CacheMessageListener.class);
//      cr.updateDependencies();

      cache.start();


      CacheSPI recipient = (CacheSPI) new DefaultCacheFactory().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_ASYNC), false);
      recipient.getConfiguration().setClusterName("VersionedTestBase");
      recipient.getConfiguration().setReplVersionString(getReplicationVersion());
      // Use a long timeout to facilitate setting debugger breakpoints
      recipient.getConfiguration().setStateRetrievalTimeout(60000);

      //Put the cache in the map before starting, so if it fails in
      // start it can still be destroyed later
      caches.put("secretive2", recipient);

      // inject our own message listener and re-wire deps
      cr = TestingUtil.extractComponentRegistry(recipient);
      //cr.unregisterComponent(CacheMessageListener.class);
      cr.registerComponent(CacheMessageListener.class.getName(), new SecretiveStateCacheMessageListener(), CacheMessageListener.class);
      //cr.updateDependencies();

      try
      {
         recipient.start();
View Full Code Here

    * @param cache cache to introspect
    * @return component registry
    */
   public static ComponentRegistry extractComponentRegistry(CacheImpl ci)
   {
      ComponentRegistry cr = (ComponentRegistry) extractField(ci, "componentRegistry");
      return cr;
   }
View Full Code Here

    * @param cache       cache that needs to be altered
    * @param interceptor the first interceptor in the new chain.
    */
   public static void replaceInterceptorChain(CacheSPI<?, ?> cache, Interceptor interceptor)
   {
      ComponentRegistry cr = extractComponentRegistry(cache);

      // This will replace the previous interceptor chain in the component registry
      // as well as update dependencies!
      cr.registerComponent(Interceptor.class.getName(), interceptor, Interceptor.class);
   }
View Full Code Here

    * @param cache cache instance for which a remote delegate is to be retrieved
    * @return remote delegate, or null if the cacge is not configured for replication.
    */
   public static RemoteCacheInvocationDelegate getRemoteDelegate(CacheSPI cache)
   {
      ComponentRegistry cr = extractComponentRegistry(cache);
      return cr.getComponent("remoteDelegate", RemoteCacheInvocationDelegate.class);
   }
View Full Code Here

    * Make sure the 2 caches have different component instances
    */
   public void testSeparateNotifiersAndListeners()
   {
      assert cache1 != cache2;
      ComponentRegistry cr1, cr2;
      cr1 = TestingUtil.extractComponentRegistry(cache1);
      cr2 = TestingUtil.extractComponentRegistry(cache2);
      assert cr1 != cr2;
      assert cr1.getComponent(Notifier.class) != cr2.getComponent(Notifier.class);
      assert eventLog1 != eventLog2;
      assert cache1.getLocalAddress() != cache2.getLocalAddress();
      CacheSPI spi1, spi2;
      spi1 = (CacheSPI) cache1;
      spi2 = (CacheSPI) cache2;
View Full Code Here

   {
      Pojo pojo = new Pojo();
      MarshalledValue mv = new MarshalledValue(pojo);

      Configuration c = new Configuration();
      ComponentRegistry cr = new ComponentRegistry(c);

      Marshaller marshaller = new CacheMarshaller210();
      cr.registerComponent(marshaller, Marshaller.class);

      // Wire the marshaller
      cr.start();

      // start the test
      ByteArrayOutputStream bout = new ByteArrayOutputStream();
      ObjectOutputStream out = new ObjectOutputStream(bout);
      marshaller.objectToObjectStream(mv, out);
View Full Code Here

      regionManager = new RegionManager();
      c = new Configuration();
      c.setUseRegionBasedMarshalling(false);
      c.setInactiveOnStartup(false);
      c.setReplVersionString(currentVersion);
      cr = new ComponentRegistry(c);
      //c.setUseReferenceCounting(true);
      marshaller = createVAMandRestartCache(regionManager);
   }
View Full Code Here

public class VersionAwareMarshallerTest extends AbstractVersionAwareMarshallerTest
{
   @BeforeMethod
   public void setUp()
   {
      cr = new ComponentRegistry(new Configuration());
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.factories.ComponentRegistry

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.