Package org.jboss.cache.config

Examples of org.jboss.cache.config.Option


    * @throws Throwable if allowed to throw one.
    */
   public void throwIfNeeded(Throwable e) throws Throwable
   {
      // TODO: this stuff really doesn't belong here.  Put it somewhere else.
      Option optionOverride = getOptionOverrides();
      boolean shouldRethtrow = optionOverride == null || !optionOverride.isFailSilently();
      if (!shouldRethtrow)
      {
         if (trace)
            log.trace("There was a problem handling this request, but failSilently was set, so suppressing exception", e);
         return;
View Full Code Here


      if (fqn.isRoot())
      {
         boolean result = true;
         // we need to preserve options
         InvocationContext ctx = getInvocationContext();
         Option o = ctx.getOptionOverrides();
         Set<Fqn> internalFqns = getInternalFqns();
         for (Object childName : peek(fqn, false, false).getChildrenNames())
         {
            if (!internalFqns.contains(Fqn.fromElements(childName)))
            {
View Full Code Here

   public Node<K, V> addChild(Fqn f)
   {
      // TODO: Revisit.  Is this really threadsafe?  See comment in putIfAbsent() - same solution should be applied here too.
      assertValid();
      Fqn nf = Fqn.fromRelativeFqn(getFqn(), f);
      Option o1 = spi.getInvocationContext().getOptionOverrides().copy();
      Node<K, V> child = getChild(f);

      if (child == null)
      {
         if (trace) log.trace("Child is null; creating.");
         Option o2 = o1.copy();
         spi.getInvocationContext().setOptionOverrides(o1);
         spi.put(nf, null);
         if (trace) log.trace("Created.  Now getting again.");
         spi.getInvocationContext().setOptionOverrides(o2);
         child = getChild(f);
View Full Code Here

      return null;
   }

   private void copyForcedCacheModeToTxScope(InvocationContext ctx)
   {
      Option optionOverride = ctx.getOptionOverrides();
      if (optionOverride != null
            && (optionOverride.isForceAsynchronous() || optionOverride.isForceSynchronous()))
      {
         TransactionContext transactionContext = ctx.getTransactionContext();
         if (transactionContext != null)
         {
            if (optionOverride.isForceAsynchronous())
               transactionContext.setForceAsyncReplication(true);
            else
               transactionContext.setForceSyncReplication(true);
         }
      }
View Full Code Here

         return handleDataVersionCommand(ctx, command);
      }

      private Object handleDataVersionCommand(InvocationContext ctx, VersionedDataCommand command) throws Throwable
      {
         Option originalOption = ctx.getOptionOverrides();
         if (command.isVersioned())
         {
            Option option = new Option();
            option.setDataVersion(command.getDataVersion());
            ctx.setOptionOverrides(option);
         }
         Object retval;
         try
         {
View Full Code Here

   {
      // notify the transaction tCtx that this override is in place.
      TransactionContext tCtx = txTable.get(ctx.getGlobalTransaction());
      if (tCtx != null)
      {
         Option txScopeOption = new Option();
         txScopeOption.setCacheModeLocal(ctx.getOptionOverrides() != null && ctx.getOptionOverrides().isCacheModeLocal());
         txScopeOption.setSkipCacheStatusCheck(ctx.getOptionOverrides() != null && ctx.getOptionOverrides().isSkipCacheStatusCheck());
         tCtx.setOption(txScopeOption);
      }
   }
View Full Code Here

   private Object handleWriteMethod(InvocationContext ctx, Fqn targetFqn, Fqn from, VisitableCommand command)
         throws Throwable
   {
      Object retval = invokeNextInterceptor(ctx, command);
      Transaction tx = ctx.getTransaction();
      Option optionOverride = ctx.getOptionOverrides();
      if (log.isDebugEnabled()) log.debug("Is a CRUD method");
      Set<Fqn> fqns = new HashSet<Fqn>();
      if (from != null)
      {
         fqns.add(from);
View Full Code Here

      c = new Configuration();
      c.setCacheMode("REPL_SYNC");
      c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
      cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);

      cacheModeLocal = new Option();
      cacheModeLocal.setCacheModeLocal(true);
   }
View Full Code Here

      cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);

      cache1.start();
      cache2.start();

      asyncOption = new Option();
      asyncOption.setForceAsynchronous(true);

      syncOption = new Option();
      syncOption.setForceSynchronous(true);

      Option local = new Option();
      local.setCacheModeLocal(true);

      cache1.getInvocationContext().setOptionOverrides(local);
      cache1.put(FQNA, KEY, VALUE1);

      assertEquals("Cache1 correct", VALUE1, cache1.get(FQNA, KEY));

      local = new Option();
      local.setCacheModeLocal(true);
      cache2.getInvocationContext().setOptionOverrides(local);
      cache2.put(FQNA, KEY, VALUE1);

      // Validate data is as expected
      assertEquals("Cache1 correct", VALUE1, cache1.get(FQNA, KEY));
View Full Code Here

      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);

      cache.start();

      option = new Option();
      option.setLockAcquisitionTimeout(0);
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.config.Option

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.