Examples of HeapException


Examples of net.sf.joafip.kvstore.service.HeapException

  }

  @Override
  public void copy(final FileForStorable fileForStorable)
      throws HeapException {
    throw new HeapException("unsupported");
  }
View Full Code Here

Examples of net.sf.joafip.kvstore.service.HeapException

    return 0;
  }

  private void assertOpenned() throws HeapException {
    if (!openned) {
      throw new HeapException("is closed");
    }
  }
View Full Code Here

Examples of net.sf.joafip.kvstore.service.HeapException

    }
  }

  private void assertClosed() throws HeapException {
    if (openned) {
      throw new HeapException("is openned");
    }
  }
View Full Code Here

Examples of net.sf.joafip.kvstore.service.HeapException

      final BlockDataManagerHeader header = (BlockDataManagerHeader) objectInputStream
          .readObject();
      objectInputStream.close();
      set(header);
    } catch (IOException exception) {
      throw new HeapException(exception);
    } catch (ClassNotFoundException exception) {
      throw new HeapException(exception);
    }
  }
View Full Code Here

Examples of net.sf.joafip.kvstore.service.HeapException

          byteArrayOutputStream);
      objectOutputStream.writeObject(this);
      objectOutputStream.close();
      return byteArrayOutputStream.toByteArray();
    } catch (IOException exception) {
      throw new HeapException(exception);
    }
  }
View Full Code Here

Examples of net.sf.joafip.kvstore.service.HeapException

            + fileForStorableBackup.getFile().getName();
        /*
         * need some files maintenance
         */
        LOGGER.fatal(message);
        throw new HeapException(message, EnumFileState.STATE_UNSTABLE);
      } else if (backupFlagExists && !backupExists) {
        final String message = "data flag " + stateOkFlagFile.getName()
            + " exists but missing data file "
            + fileForStorable.getFile().getName();
        /*
         * need some files maintenance
         */
        LOGGER.fatal(message);
        throw new HeapException(message, EnumFileState.STATE_UNSTABLE);

      } else if (globalFlagExists) {
        /*
         * global flag exists
         */
        if (dataFlagExists && backupFlagExists) {
          /*
           * data and backup file in stable state
           */
          LOGGER.info(FILES_IN_STABLE_STATE);
        } else {
          /*
           * flag file inconsistency, data and backup flag file must
           * exists if global flag file exist
           */
          /*
           * may be first time case when there is no file present
           */
          inconsistencyCheck(backupExists, dataExists);
        }
        restored = false;
      } else {
        try {
          /*
           * global flag do not exists
           */
          if (dataFlagExists && backupFlagExists) {
            /*
             * backup file may not be up to date, create it from
             * data file
             */
            HELPER_FILE_UTIL.copyFile(fileForStorable.getFile(),
                fileForStorableBackup.getFile());
            LOGGER.warn(BACKUP_FILE_NOT_IN_STABLE_STATE_RESTORED);
            restored = true;
          } else if (!dataFlagExists && backupFlagExists) {
            /*
             * data file not in stable state
             */
            /*
             * since backup file in stable state, create data file
             * from backup file
             */
            HELPER_FILE_UTIL.copyFile(
                fileForStorableBackup.getFile(),
                fileForStorable.getFile());
            LOGGER.warn(DATA_FILE_NOT_IN_STABLE_STATE_RESTORED);
            restored = true;
            dataLost = true;
          } else if (dataFlagExists && !backupFlagExists) {
            /*
             * backup file not in stable state, create it from data
             * file
             */
            HELPER_FILE_UTIL.copyFile(fileForStorable.getFile(),
                fileForStorableBackup.getFile());
            LOGGER.warn(BACKUP_FILE_NOT_IN_STABLE_STATE_RESTORED);
            restored = true;
          } else {
            /*
             * flag file inconsistency, one of data and backup flag
             * file must exists if global flag file not exist
             */
            /*
             * may be first time case when there is no file present
             */
            inconsistencyCheck(backupExists, dataExists);
            restored = false;
          }
        } catch (FileIOException exception) {
          throw new HeapException(exception);
        }
      }
    } else {
      restored = false;
    }
View Full Code Here

Examples of net.sf.joafip.kvstore.service.HeapException

          + backupExists;
      /*
       * need some files maintenance
       */
      LOGGER.fatal(message);
      throw new HeapException(message, EnumFileState.STATE_UNSTABLE);
    } else {
      /*
       * no data, empty
       */
      LOGGER.warn(NO_FILES);
 
View Full Code Here

Examples of net.sf.joafip.kvstore.service.HeapException

        HELPER_FILE_UTIL.touchFile(stateOkFlagFile,
            maxFileOperationRetry, fileOperationRetryMsDelay);
        HELPER_FILE_UTIL.touchFile(globalStateFlagFile,
            maxFileOperationRetry, fileOperationRetryMsDelay);
      } catch (FileIOException exception) {
        throw new HeapException(exception);
      }
    }
  }
View Full Code Here

Examples of net.sf.joafip.kvstore.service.HeapException

      try {
        setStartSaveFlagFile();
        fileForStorable.resetFileSize();
      } catch (HeapException exception) {
        LOGGER.fatal(OPEN_FAILED, exception);
        throw new HeapException(OPEN_FAILED, exception);
      } catch (FileIOException exception) {
        LOGGER.fatal(OPEN_FAILED, exception);
        throw new HeapException(OPEN_FAILED, exception);
      }
      if (crashSafeMode) {
        try {
          setStartBackupFlagFile();
        } catch (FileIOException exception) {
          throw new HeapException(exception);
        }
        try {
          fileForStorableBackup.resetFileSize();
        } catch (HeapException exception) {
          LOGGER.fatal(OPEN_FAILED, exception);
          throw exception;
        }
      }
      try {
        setEndSaveFlagFile();
      } catch (FileIOException exception) {
        throw new HeapException(exception);
      }
    }
    header.clear();
    /* to save new header */
    header.setValueIsChangedValueToSave();
 
View Full Code Here

Examples of net.sf.joafip.kvstore.service.HeapException

   *             service is stopped
   */
  private boolean assertServiceStarted() throws HeapException {
    if (!serviceStarted) {
      LOGGER.fatal(RECORD_MANAGER_IS_STOPPED);
      throw new HeapException(RECORD_MANAGER_IS_STOPPED, stopperTrace);
    }
    return true;
  }
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.