Examples of InvalidRecordLocationException


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

Examples of org.activeio.journal.InvalidRecordLocationException

        }
    }

    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

Examples of org.activeio.journal.InvalidRecordLocationException

            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

Examples of org.activeio.journal.InvalidRecordLocationException

      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

Examples of org.activeio.journal.InvalidRecordLocationException

     * @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

Examples of org.activeio.journal.InvalidRecordLocationException

    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

Examples of org.activeio.journal.InvalidRecordLocationException

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

Examples of org.activeio.journal.InvalidRecordLocationException

            // 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

Examples of org.activeio.journal.InvalidRecordLocationException

     
      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

Examples of org.apache.activeio.journal.InvalidRecordLocationException

        LogFile logFile;
        LogFileNode logFileState = getLogFileWithId(location.getLogFileId());
        if( logFileState !=null ) {
            // 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.");
            }
            logFile = logFileState.getLogFile();
        } else {
            if( archiveDirectory==null ) {
                throw new InvalidRecordLocationException("Log file: " + location.getLogFileId() + " is not active.");
            } else {
                logFile = getArchivedLogFile(location.getLogFileId());
            }
        }

        // Is there a record header at the seeked location?
        try {
            Record header = new Record();
            logFile.readRecordHeader(location.getLogFileOffset(), header);
            return new RecordInfo(location, header, logFileState, logFile);
        } catch (IOException e) {
            throw new InvalidRecordLocationException("No record at (" + location + ") found.");
        }
    }
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.