Package org.activeio.journal

Examples of org.activeio.journal.InvalidRecordLocationException


    synchronized public void setMark(RecordLocation l, boolean force) throws InvalidRecordLocationException,
            IOException {
       
        Location location = (Location) l;
        if (location == null)
            throw new InvalidRecordLocationException("The location cannot be null.");
        if (lastMarkedLocation != null && location.compareTo(lastMarkedLocation) < 0)
            throw new InvalidRecordLocationException("The location is less than the last mark.");
       
        markPacket.clear();
        location.writeToPacket(markPacket);   
        markPacket.flip();
        write(LogFileManager.MARK_RECORD_TYPE, markPacket, force, location);
View Full Code Here


        }
    }

    private Object unwrapException(InvocationTargetException e) throws InvalidRecordLocationException, IOException {
        if (e.getTargetException() instanceof InvalidRecordLocationException)
            throw new InvalidRecordLocationException(e.getTargetException().getMessage(), e.getTargetException());
        if (e.getTargetException() instanceof IOException)
            throw (IOException) new IOException(e.getTargetException().getMessage()).initCause(e
                    .getTargetException());
        throw (IOException) new IOException("Unexpected Exception: ").initCause(e.getTargetException());
    }
View Full Code Here

            return (Packet) result.get();
        } catch (InterruptedException e) {
            throw (IOException) new IOException("Interrupted.").initCause(e);
        } catch (InvocationTargetException e) {
            if (e.getTargetException() instanceof InvalidRecordLocationException)
                throw new InvalidRecordLocationException(e.getTargetException().getMessage(), e.getTargetException());
            if (e.getTargetException() instanceof IOException)
                throw (IOException) new IOException(e.getTargetException().getMessage()).initCause(e
                        .getTargetException());
            throw (IOException) new IOException("Unexpected Exception: ").initCause(e.getTargetException());
        }
View Full Code Here

      throw (InterruptedIOException) new InterruptedIOException()
          .initCause(e);
    } catch (IOException e) {
      throw e;
    } catch (InvalidLogKeyException e) {
      throw new InvalidRecordLocationException(e.getMessage(), e);
    } catch (Exception e) {
      throw (IOException) new IOException("Journal write failed: " + e)
          .initCause(e);
    }
  }
View Full Code Here

     * @throws InvalidRecordLocationException
     */
    private long toLong(RecordLocation recordLocator) throws InvalidRecordLocationException {
        if (recordLocator == null
            || recordLocator.getClass() != LongRecordLocation.class)
          throw new InvalidRecordLocationException();

        long location = ((LongRecordLocation) recordLocator)
            .getLongLocation();
        return location;
    }
View Full Code Here

    RecordInfo readRecordInfo(Location location) throws IOException, InvalidRecordLocationException {

        LogFileNode logFileState = getLogFileWithId(location.getLogFileId());
        // There can be no record at the append offset.
        if (logFileState.getAppendOffset() == location.getLogFileOffset()) {
            throw new InvalidRecordLocationException("No record at (" + location
                    + ") found.  Location past end of logged data.");
        }

        // Is there a record header at the seeked location?
        try {
            LogFile logFile = logFileState.getLogFile();
            Record header = new Record();
            logFile.readRecordHeader(location.getLogFileOffset(), header);
            return new RecordInfo(location, header, logFileState);
        } catch (IOException e) {
            throw new InvalidRecordLocationException("No record at (" + location + ") found.");
        }
    }
View Full Code Here

              lastLocation = new LongRecordLocation(next.key);
              if( !next.isCTRL() )
                  return lastLocation;
          }
    } catch (Exception e) {
      throw (InvalidRecordLocationException)new InvalidRecordLocationException().initCause(e);
        }
   
  }
View Full Code Here

            // Short cut since id's will only increment
            if (logFileId < lf.getId())
                break;
        }
        throw new InvalidRecordLocationException("Log file with id;" + logFileId + " is not active.");
    }
View Full Code Here

     
      try {
            LogRecord record = logger.get(null, toLong(location));
            return new ByteArrayPacket(record.data);           
    } catch (InvalidLogKeyException e) {
      throw new InvalidRecordLocationException(e.getMessage(), e);
    } catch (Exception e) {
      throw (IOException) new IOException("Journal write failed: " + e)
          .initCause(e);
    }
   
View Full Code Here

TOP

Related Classes of org.activeio.journal.InvalidRecordLocationException

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.