Examples of CachePersistenceException


Examples of com.opensymphony.oscache.base.persistence.CachePersistenceException

        try {
            File file = getCacheGroupFile(group);

            return file.exists();
        } catch (Exception e) {
            throw new CachePersistenceException("Unable verify group '" + group + "' exists in the cache: " + e);
        }
    }
View Full Code Here

Examples of com.opensymphony.oscache.base.persistence.CachePersistenceException

        try {
            File file = getCacheFile(key);

            return file.exists();
        } catch (Exception e) {
            throw new CachePersistenceException("Unable verify id '" + key + "' is stored in the cache: " + e);
        }
    }
View Full Code Here

Examples of com.opensymphony.oscache.base.persistence.CachePersistenceException

        File groupFile = getCacheGroupFile(groupName);

        try {
            return (Set) retrieve(groupFile);
        } catch (ClassCastException e) {
            throw new CachePersistenceException("Group file " + groupFile + " was not persisted as a Set: " + e);
        }
    }
View Full Code Here

Examples of com.opensymphony.oscache.base.persistence.CachePersistenceException

                    Thread.sleep(DELETE_THREAD_SLEEP);
                } catch (InterruptedException ignore) {
                }
            }
        } catch (Exception e) {
            throw new CachePersistenceException("Unable to remove '" + file + "' from the cache: " + e);
        }
        if (file.exists() && count == 0) {
            throw new CachePersistenceException("Unable to delete '" + file + "' from the cache. "+DELETE_COUNT+" attempts at "+DELETE_THREAD_SLEEP+" milliseconds intervals.");
        }
    }
View Full Code Here

Examples of com.opensymphony.oscache.base.persistence.CachePersistenceException

            try {
                if (!filepath.exists()) {
                    filepath.mkdirs();
                }
            } catch (Exception e) {
                throw new CachePersistenceException("Unable to create the directory " + filepath);
            }
        }

        // Write the object to disk
        try {
            FileOutputStream fout = new FileOutputStream(file);
            try {
                ObjectOutputStream oout = new ObjectOutputStream(new BufferedOutputStream(fout));
                try {
                    oout.writeObject(obj);
                    oout.flush();
                } finally {
                    try {
                        oout.close();
                    } catch (Exception e) {
                    }
                }
            } finally {
                try {
                    fout.close();
                } catch (Exception e) {
                }
            }
        } catch (Exception e) {
            int count = DELETE_COUNT;
            while (file.exists() && !file.delete() && count != 0) {
                count--;
                try {
                    Thread.sleep(DELETE_THREAD_SLEEP);
                } catch (InterruptedException ignore) {
                }
            }
            throw new CachePersistenceException("Unable to write '" + file + "' in the cache. Exception: " + e.getClass().getName() + ", Message: " + e.getMessage());
        }
    }
View Full Code Here

Examples of com.opensymphony.oscache.base.persistence.CachePersistenceException

            }

            // Delete the root directory
            baseDir.delete();
        } catch (Exception e) {
            throw new CachePersistenceException("Unable to clear the cache directory");
        }
    }
View Full Code Here

Examples of com.opensymphony.oscache.base.persistence.CachePersistenceException

        boolean fileExist;

        try {
            fileExist = file.exists();
        } catch (Exception e) {
            throw new CachePersistenceException("Unable to verify if " + file + " exists: " + e);
        }

        // Read the file if it exists
        if (fileExist) {
            ObjectInputStream oin = null;

            try {
                BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
                oin = new ObjectInputStream(in);
                readContent = oin.readObject();
            } catch (Exception e) {
                // We expect this exception to occur.
                // This is when the item will be invalidated (written or deleted)
                // during read.
                // The cache has the logic to retry reading.
                throw new CachePersistenceException("Unable to read '" + file.getAbsolutePath() + "' from the cache: " + e);
            } finally {
              // HHDE: no need to close in. Will be closed by oin
                try {
                    oin.close();
                } catch (Exception ex) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.