Package org.jboss.cache.config

Examples of org.jboss.cache.config.Option


  // Cache impl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  public Object get(Object key) throws CacheException {
    try {
      Option option = new Option();
      option.setFailSilently( true );
//      option.setDataVersion( NonLockingDataVersion.INSTANCE );
      return cache.get( new Fqn( regionFqn, key ), ITEM, option );
    }
    catch (Exception e) {
      throw new CacheException(e);
View Full Code Here


    }
  }

  public void update(Object key, Object value) throws CacheException {
    try {
      Option option = new Option();
      option.setDataVersion( NonLockingDataVersion.INSTANCE );
      cache.put( new Fqn( regionFqn, key ), ITEM, value, option );
    }
    catch (Exception e) {
      throw new CacheException(e);
    }
View Full Code Here

  public void put(Object key, Object value) throws CacheException {
    try {
      log.trace( "performing put() into region [" + regionName + "]" );
      // do the put outside the scope of the JTA txn
      Option option = new Option();
      option.setFailSilently( true );
      option.setDataVersion( NonLockingDataVersion.INSTANCE );
      cache.put( new Fqn( regionFqn, key ), ITEM, value, option );
    }
    catch (TimeoutException te) {
      //ignore!
      log.debug("ignoring write lock acquisition failure");
View Full Code Here

  public void remove(Object key) throws CacheException {
    try {
      // tree cache in optimistic mode seems to have as very difficult
      // time with remove calls on non-existent nodes (NPEs)...
      if ( cache.get( new Fqn( regionFqn, key ), ITEM ) != null ) {
        Option option = new Option();
        option.setDataVersion( NonLockingDataVersion.INSTANCE );
        cache.remove( new Fqn( regionFqn, key ), option );
      }
      else {
        log.trace( "skipping remove() call as the underlying node did not seem to exist" );
      }
View Full Code Here

    }
  }

  public void clear() throws CacheException {
    try {
      Option option = new Option();
      option.setDataVersion( NonLockingDataVersion.INSTANCE );
      cache.remove( regionFqn, option );
    }
    catch (Exception e) {
      throw new CacheException(e);
    }
View Full Code Here

    }
  }

  public void destroy() throws CacheException {
    try {
      Option option = new Option();
      option.setCacheModeLocal( true );
      option.setFailSilently( true );
      option.setDataVersion( NonLockingDataVersion.INSTANCE );
      cache.remove( regionFqn, option );
    }
    catch( Exception e ) {
      throw new CacheException( e );
    }
View Full Code Here

   protected void createTombstone(InvocationContext ctx)
   {
      if (trace)
         log.trace("Node doesn't exist; creating a tombstone with data version " + dataVersion);
      // create the node we need.
      Option o = ctx.getOptionOverrides();
      boolean origCacheModeLocal = o.isCacheModeLocal();
      o.setCacheModeLocal(true);
      o.setDataVersion(dataVersion);
      // if we are in a tx this call should happen outside of any tx
      try
      {
         Transaction suspended = null;
         if (transactionManager != null)
View Full Code Here

      if (state.isEmpty())
      {
         if (configuredToFetchState())
            log.info("Data owner has no state to set, even though buddy is configured to accept state.  Assuming there is no data on the data owner.");
         // create the backup region anyway
         Option o = cache.getInvocationContext().getOptionOverrides();
         o.setSkipCacheStatusCheck(true);
         o = cache.getInvocationContext().getOptionOverrides();
         o.setCacheModeLocal(true);
         o.setSkipCacheStatusCheck(true);
         cache.put(Fqn.fromElements(BUDDY_BACKUP_SUBTREE, newGroup.getGroupName()), (Map) Collections.emptyMap());
      }
      else
      {
         for (Map.Entry<Fqn, byte[]> entry : state.entrySet())
View Full Code Here

   public void testCacheStoringImplicitTxOptionOverride() throws Exception
   {
      CacheSPI<Object, Object> cache = createCacheWithLoader();
      CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
      Option option = new Option();
      option.setCacheModeLocal(true);
      cache.getInvocationContext().setOptionOverrides(option);
      cache.put(fqn, key, value);
      assertEquals(value, cache.get(fqn, key));
      //now lets see if the state has been persisted in the cache loader
      assertNotNull(loader.get(fqn));
View Full Code Here

    */
   public Option getOptionOverrides()
   {
      if (optionOverrides == null)
      {
         optionOverrides = new Option();
      }
      return optionOverrides;
   }
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.