Package net.sf.joafip.kvstore.service

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


  private boolean assertPreviousPositionInFile() throws HeapException {
    if (previousRecordPositionInFile != null
        && previousRecordPositionInFile == -1
        && positionInFile != HeapHeader.HEAP_HEADER_SIZE) {
      throw new HeapException("bad position of first record "
          + positionInFile + " for " + HeapHeader.HEAP_HEADER_SIZE
          + " expected");
    }
    return true;
  }
View Full Code Here


  }

  private boolean assertCanUnFreeRecordForRecordSize(final int recordSize)
      throws HeapException {
    if (!freeRecord) {
      throw new HeapException("already a free record");
    }
    assertRecordSizeKnew();
    if (recordSize > this.recordSize) {
      logger.fatal(CAN_NOT_INCREASE_RECORD_RECORD_SIZE + " current size="
          + this.recordSize + " asked size=" + recordSize);
      throw new HeapException(new HeapException(
          CAN_NOT_INCREASE_RECORD_RECORD_SIZE));
    }
    return true;
  }
View Full Code Here

  }

  private boolean assertCanUnfreeRecordForDataAssociateSize(
      final int dataAssociatedSize) throws HeapException {
    if (!freeRecord) {
      throw new HeapException("already a free record");
    }
    assertRecordSizeKnew();
    // dataAssociatedSize + 4 : +4 for crc32
    if (recordSize < MAX_RECORD_HEADER_SIZE + dataAssociatedSize + 4) {
      logger.fatal(RECORD_SIZE_TO_SMALL_FOR_DATA);
      throw new HeapException(new HeapException(
          RECORD_SIZE_TO_SMALL_FOR_DATA));
    }
    return true;
  }
View Full Code Here

  private void assertDataRecordStateForMarshalling() throws HeapException {
    if ((dataAssociatedSize == null /* || dataAssociatedSize <= 0 */)) {
      logger.fatal(ASSOCIATED_DATA_SIZE_MUST_BE_DEFINED
          + " data record identifier=" + nodeIdentifier);
      throw new HeapException(ASSOCIATED_DATA_SIZE_MUST_BE_DEFINED);
    }
    if (dataAssociated == null) {
      logger.fatal(NO_DATA_TO_WRITE_SET + " data record identifier="
          + nodeIdentifier);
      throw new HeapException(NO_DATA_TO_WRITE_SET);
    }
    if (dataAssociated.length != dataAssociatedSize) {
      logger.fatal(CAN_NOT_CHANGE_DATA_SIZE + " this record data size="
          + dataAssociatedSize + " try to write "
          + dataAssociated.length + " data record iddentifier="
          + nodeIdentifier);
      throw new HeapException(CAN_NOT_CHANGE_DATA_SIZE);
    }
  }
View Full Code Here

  private void assertFreeRecordStateForMarshalling() throws HeapException {
    if (dataValueChanged
        || (dataAssociatedSize != null && dataAssociatedSize > 0)) {
      logger.fatal(CAN_NOT_MANAGE_DATA_ON_FREE_RECORD);
      throw new HeapException(new HeapException(
          CAN_NOT_MANAGE_DATA_ON_FREE_RECORD));
    }
  }
View Full Code Here

        writeByte((byte) 0x03);
      } else {
        writeByte((byte) 0x02);
      }
    } else {
      throw new HeapException("data record color not set");
    }
    writeInteger(numberOfChild);
    writeLong(nodeIdentifier.value);
    final byte[] keyData = nodeIdentifier.getKeyData();
    if (keyData != null) {
View Full Code Here

        writeByte((byte) 0x03);
      } else {
        writeByte((byte) 0x02);
      }
    } else {
      throw new HeapException("free record color not set");
    }
    // writeInteger(freeNode.getNumberOfChild());
    writeInteger(numberOfChild);
    writeCrc32(0);
  }
View Full Code Here

        unmarshallFreeRecordHeader();
      } else {
        unmarshallDataRecordHeader();
      }
    } catch (RBTException exception) {
      throw new HeapException(exception);
    }
  }
View Full Code Here

    } else if (colorCode == 0x03) {
      colorSetted = true;
      color = true;
    } else {
      // colorSetted = false;
      throw new HeapException("data record color not set");
    }
    numberOfChild = readInteger();
    final long long1 = readLong();
    if (long1 == -1) {
      final int keySize = readInteger();
View Full Code Here

      // freeNode.setColorUnmarshalling(true);
      colorSetted = true;
      color = true;
    } else {
      // colorSetted = false;
      throw new HeapException("free record color not set");
    }
    // freeNode.setNumberOfChildUnmarshalling(readInteger());
    numberOfChild = readInteger();
    // freeNode.valueSetted();
    readAndCheckCrc32(0);
View Full Code Here

TOP

Related Classes of net.sf.joafip.kvstore.service.HeapException

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.