Package org.jboss.cache.factories

Examples of org.jboss.cache.factories.ComponentRegistry


//      RegionManager rm = new RegionManager();
      final CacheMarshaller200 cm200 = new CacheMarshaller200();
      c.setInactiveOnStartup(false);
      c.setUseRegionBasedMarshalling(true);
      c.setCacheMarshaller(cm200);
      ComponentRegistry cr = this.cr;
      cr.registerComponent(cm200, CacheMarshaller200.class);
      cr.rewire();
      cr.start();

      RegionManager rm = cr.getComponent(RegionManager.class);
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      final Fqn region = Fqn.fromString("/hello");
      Region r = rm.getRegion(region, true);
      r.registerContextClassLoader(this.getClass().getClassLoader());
View Full Code Here


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

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

      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

   }

   @Override
   protected void checkLocks()
   {
      ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);
      LockManager lm = cr.getComponent(LockManager.class);
      InvocationContextContainer icc = cr.getComponent(InvocationContextContainer.class);

      LockAssert.assertNotLocked(A, lm, icc);
      LockAssert.assertNotLocked(Fqn.ROOT, lm, icc);
      LockAssert.assertLocked(C, lm, icc);
      LockAssert.assertLocked(A_B, lm, icc);
View Full Code Here

   }

   @Override
   protected void checkLocksDeep()
   {
      ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);
      LockManager lm = cr.getComponent(LockManager.class);
      InvocationContextContainer icc = cr.getComponent(InvocationContextContainer.class);

      LockAssert.assertNotLocked(A, lm, icc);
      LockAssert.assertNotLocked(Fqn.ROOT, lm, icc);
      LockAssert.assertNotLocked(A_B_D, lm, icc);
View Full Code Here

   }

   @Override
   protected void assertNoLocks()
   {
      ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);
      LockManager lm = cr.getComponent(LockManager.class);
      InvocationContextContainer icc = cr.getComponent(InvocationContextContainer.class);
      LockAssert.assertNoLocks(lm, icc);
   }
View Full Code Here

   {
      long startTime = System.currentTimeMillis();
      log.warn("Starting cache");
      cache.start();
      // now remove the existing RpcDispatcher and replace with one that is a noop.
      ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);
      RPCManager rpcManager = cr.getComponent(RPCManager.class);
      RpcDispatcher d = (RpcDispatcher) TestingUtil.extractField(rpcManager, "rpcDispatcher");
      d.stop();
      RpcDispatcher replacement = new NoopDispatcher();
      replacement.setRequestMarshaller(d.getRequestMarshaller());
      replacement.setResponseMarshaller(d.getResponseMarshaller());
View Full Code Here

            cache.getConfiguration().getCacheMode() == Configuration.CacheMode.REPL_ASYNC;
   }

   private void replaceInternal()
   {
      ComponentRegistry componentRegistry = TestingUtil.extractComponentRegistry(cache);
      InterceptorChain ic = componentRegistry.getComponent(InterceptorChain.class);
      List<CommandInterceptor> commands = ic.getInterceptorsWhichExtend(BaseRpcInterceptor.class);
      for (CommandInterceptor interceptor: commands)
      {
         ReplicationQueue original = (ReplicationQueue) TestingUtil.extractField(BaseRpcInterceptor.class, interceptor, "replicationQueue");
         TestingUtil.replaceField(new ReplicationQueueDelegate(original),"replicationQueue", interceptor, BaseRpcInterceptor.class);
View Full Code Here

   /**
    * Builds a listener that will observe the given cache for recieving replication commands.
    */
   protected ReplicationListener(Cache cache)
   {
      ComponentRegistry componentRegistry = TestingUtil.extractComponentRegistry(cache);
      RPCManager rpcManager = componentRegistry.getComponent(RPCManager.class);
      CommandAwareRpcDispatcher realDispatcher = (CommandAwareRpcDispatcher) TestingUtil.extractField(rpcManager, "rpcDispatcher");
      if (realDispatcher.setReplicationObserver(this) != null)
      {
         throw new RuntimeException("Replication listener already present");
      }
View Full Code Here

   }

   public void testOOBFlag() throws Exception
   {
      DelegatingRPCManager delegatingRPCManager = new DelegatingRPCManager();
      ComponentRegistry cr = TestingUtil.extractComponentRegistry(c1);
      RPCManager origRpcManager = cr.getComponent(RPCManager.class);
      delegatingRPCManager.delegate = origRpcManager;
      cr.registerComponent(delegatingRPCManager, RPCManager.class);
      cr.rewire();

      c1.getTransactionManager().begin();
      c1.put("/a", "k", "v");
      c1.getTransactionManager().commit();
View Full Code Here

      threadLocal.set(tl);
      tl.c = new Configuration();
      tl.c.setUseRegionBasedMarshalling(false);
      tl.c.setInactiveOnStartup(false);
      tl.c.setReplVersionString(currentVersion);
      ComponentRegistry cr = new ComponentRegistry(tl.c, new CacheInvocationDelegate());
      this.cr = cr;
      tl.marshaller = createVAMandRestartCache(new RegionManagerImpl());
      tl.regionManager = cr.getComponent(RegionManager.class);
   }
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.