Package javax.cache.integration

Examples of javax.cache.integration.CacheWriterException


      return new PersistenceException(e);
   }

   static RuntimeException launderCacheWriterException(Exception e) {
      if (!(e instanceof CacheWriterException))
         return new CacheWriterException("Exception in CacheWriter", e);

      return new CacheException("Error in CacheWriter", e);
   }
View Full Code Here


                final Object objValue = toValue(value);
                CacheEntry<?, ?> entry = new CacheEntry<Object, Object>(objKey, objValue);
                cacheWriter.write(entry);
            } catch (Exception e) {
                if (!(e instanceof CacheWriterException)) {
                    throw new CacheWriterException("Exception in CacheWriter during write", e);
                } else {
                    throw (CacheWriterException) e;
                }
            }
        }
View Full Code Here

            try {
                final Object objKey = dataToValue(key);
                cacheWriter.delete(objKey);
            } catch (Exception e) {
                if (!(e instanceof CacheWriterException)) {
                    throw new CacheWriterException("Exception in CacheWriter during delete", e);
                } else {
                    throw (CacheWriterException) e;
                }
            }
        }
View Full Code Here

            final Set<Object> keysObject = keysToDelete.keySet();
            try {
                cacheWriter.deleteAll(keysObject);
            } catch (Exception e) {
                if (!(e instanceof CacheWriterException)) {
                    throw new CacheWriterException("Exception in CacheWriter during deleteAll", e);
                } else {
                    throw (CacheWriterException) e;
                }
            } finally {
                for (Object undeletedKey : keysObject) {
View Full Code Here

                return ehcache.removeWithWriter(key);
            } catch (RuntimeException e) {
                if(previous != null) {
                    ehcache.putQuiet(previous);
                }
                throw new CacheWriterException(e);
            }
        } else {
            if (ehcache.isKeyInCache(key)) {
                return ehcache.remove(key);
            }
View Full Code Here

        if (cfg.isWriteThrough()) {
            try {
                ehcache.putWithWriter(element);
            } catch (RuntimeException e) {
                ehcache.removeElement(element);
                throw new CacheWriterException(e);
            }
        } else {
            ehcache.put(element);
        }
    }
View Full Code Here

        if (cfg.isWriteThrough()) {
            try {
                try {
                    cacheWriter.writeAll(entries);
                } catch (RuntimeException e) {
                    throw new CacheWriterException(e);
                }
            } catch (Exception e) {
                for (Entry entry : entries) {
                    ehcache.remove(entry.getKey());
                }
                throw new CacheWriterException(e);
            }
        }
    }
View Full Code Here

                        ehcache.removeWithWriter(key);
                    } catch (RuntimeException e) {
                        if(previous != null) {
                            ehcache.putQuiet(previous);
                        }
                        throw new CacheWriterException(e);
                    }
                } finally {
                    ehcache.releaseWriteLockOnKey(key);
                }
            }
View Full Code Here

                        ehcache.removeWithWriter(key);
                    } catch (RuntimeException e) {
                        if(previous != null) {
                            ehcache.putQuiet(previous);
                        }
                        throw new CacheWriterException(e);
                    }
                } finally {
                    ehcache.releaseWriteLockOnKey(key);
                }
            }
View Full Code Here

TOP

Related Classes of javax.cache.integration.CacheWriterException

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.