Package org.jboss.cache

Examples of org.jboss.cache.Fqn


    @NodeModified
    public void nodeModified(NodeModifiedEvent event) {
      
        if (!handleEvictAllModification(event) && !event.isPre()) {
  
           Fqn fqn = event.getFqn();
           Fqn regFqn = getRegionFqn();
           if (fqn.size() == regFqn.size() + 1 && fqn.isChildOf(regFqn)) {
               Object key = fqn.get(regFqn.size());
               localCache.put(key, event.getData().get(ITEM));
           }
        }
    }


    @NodeRemoved
    public void nodeRemoved(NodeRemovedEvent event) {
        if (event.isPre())
            return;

        Fqn fqn = event.getFqn();
        Fqn regFqn = getRegionFqn();
        if (fqn.size() == regFqn.size() + 1 && fqn.isChildOf(regFqn)) {
            Object key = fqn.get(regFqn.size());
            localCache.remove(key);
        }
        else if (fqn.equals(regFqn)) {
            localCache.clear();
        }

     *            specific key to append to the <code>region</code> to form
     *            the full Fqn
     */
    public static Object get(Cache cache, Fqn region, Object key) throws CacheException {
        try {
            return cache.get(new Fqn(region, key), ITEM);
        } catch (Exception e) {
            throw new CacheException(e);
        }
    }

     *            specific key to append to the <code>region</code> to form
     *            the full Fqn
     */
    public static Object getAllowingTimeout(Cache cache, Fqn region, Object key) throws CacheException {
        try {
            return cache.get(new Fqn(region, key), ITEM);       
        }
        catch (TimeoutException ignored) {
            // ignore it
            return null;
        }

     *            <code>null</code>.
     */
    public static void put(Cache cache, Fqn region, Object key, Object value, Option option) throws CacheException {
        try {
            setInvocationOption(cache, option);
            cache.put(new Fqn(region, key), ITEM, value);
        } catch (Exception e) {
            throw new CacheException(e);
        }
    }

     *            <code>null</code>.
     */
    public static void putAllowingTimeout(Cache cache, Fqn region, Object key, Object value, Option option) throws CacheException {
        try {
            setInvocationOption(cache, option);
            cache.put(new Fqn(region, key), ITEM, value);
        }
        catch (TimeoutException allowed) {
            // ignore it
        }
        catch (Exception e) {

     */
    public static boolean putForExternalRead(Cache cache, Fqn region, Object key, Object value, Option option)
            throws CacheException {
        try {
            setInvocationOption(cache, option);
            cache.putForExternalRead(new Fqn(region, key), ITEM, value);
            return true;
        } catch (TimeoutException te) {
            // ignore!
            log.debug("ignoring write lock acquisition failure");
            return false;

     *            <code>null</code>.
     */
    public static void remove(Cache cache, Fqn region, Object key, Option option) throws CacheException {
        try {
            setInvocationOption(cache, option);
            cache.removeNode(new Fqn(region, key));
        } catch (Exception e) {
            throw new CacheException(e);
        }
    }

     *            <code>null</code>.
     */
    public static void removeNode(Cache cache, Fqn region, Object key, Option option) throws CacheException {
        try {
            setInvocationOption(cache, option);
            cache.removeNode(new Fqn(region, key));
        } catch (Exception e) {
            throw new CacheException(e);
        }
    }

    }
   
    public static void sendEvictNotification(Cache cache, Fqn region, Object member, Object key, Option option)
    {
       setInvocationOption(cache, option);
       Fqn f = Fqn.fromRelativeElements(region, Internal.NODE, member  == null ? Internal.LOCAL : member, key);
       cache.put(f, ITEM, DUMMY);
    }

TOP

Related Classes of org.jboss.cache.Fqn

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.