Package com.kolich.havalo.exceptions.objects

Examples of com.kolich.havalo.exceptions.objects.ObjectDeletionException


              // to physically remove it from disk.
              if(hfoFile.exists()) {
                if(deleteQuietly(hfoFile)) {
                  repo.deleteObject(key);
                } else {
                  throw new ObjectDeletionException("Failed " +
                    "to delete object from disk (file=" +
                      hfoFile.getAbsolutePath() +
                        ", id=" + repo.getRepoId() + ")");
                }
              } else {
                // So the object was in the index in memory, but
                // was not found on disk. Hm, probably a bigger
                // issue.
                throw new ObjectNotFoundException("Object " +
                  "file on disk not found (file=" +
                    hfoFile.getAbsolutePath() + ", id=" +
                      repo.getRepoId() + ", key=" +
                        key + ")");
              }
              return hfo;
            }
          }.write(); // Exclusive lock, fail immediately if HFO busy
        }
        @Override
        public void success(final HashedFileObject hfo) throws Exception {         
          // If we get here, then the deletion must have succeeded.
          // Queue the repository to be flushed to disk.
          metaWriter_.queue(repo);
        }
      }.read(false); // Shared reader lock on repo, no wait
    } catch (LockConflictException e) {
      throw e;
    } catch (ObjectNotFoundException e) {
      throw e;
    } catch (ObjectDeletionException e) {
      throw e;
    } catch (Exception e) {
      throw new ObjectDeletionException("Failed to delete file " +
        "object (id=" + repo.getRepoId() + ", key=" + key + ")", e);
    }
  }
View Full Code Here

TOP

Related Classes of com.kolich.havalo.exceptions.objects.ObjectDeletionException

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.