/** * Loads a previously stored JournalMessage * * @param location * @return * @throws IOException */ public JournalCommand<?> load(Location location) throws IOException { long start = System.currentTimeMillis(); ByteSequence data = journal.read(location); long end = System.currentTimeMillis(); if( LOG_SLOW_ACCESS_TIME>0 && end-start > LOG_SLOW_ACCESS_TIME) { if (LOG.isInfoEnabled()) { LOG.info("Slow KahaDB access: Journal read took: "+(end-start)+" ms"); } } DataByteArrayInputStream is = new DataByteArrayInputStream(data); byte readByte = is.readByte(); KahaEntryType type = KahaEntryType.valueOf(readByte); if( type == null ) { try { is.close(); } catch (IOException e) {} throw new IOException("Could not load journal record, null type information from: " + readByte + " at location: "+location); } JournalCommand<?> message = (JournalCommand<?>)type.createMessage(); message.mergeFramed(is); return message; }
public JournalCommand<?> load(Location location) throws IOException { DataByteArrayInputStream is = new DataByteArrayInputStream(journal.read(location)); byte readByte = is.readByte(); KahaEntryType type = KahaEntryType.valueOf(readByte); if (type == null) { throw new IOException("Could not load journal record. Invalid location: " + location); } JournalCommand<?> message = (JournalCommand<?>) type.createMessage(); message.mergeFramed(is); return message; }
/** * Loads a previously stored JournalMessage * * @param location * The location of the journal command to read. * * @return a new un-marshaled JournalCommand instance. * * @throws IOException if an error occurs reading the stored command. */ protected JournalCommand<?> load(Location location) throws IOException { ByteSequence data = journal.read(location); DataByteArrayInputStream is = new DataByteArrayInputStream(data); byte readByte = is.readByte(); KahaEntryType type = KahaEntryType.valueOf(readByte); if (type == null) { try { is.close(); } catch (IOException e) { } throw new IOException("Could not load journal record. Invalid location: " + location); } JournalCommand<?> message = (JournalCommand<?>)type.createMessage(); message.mergeFramed(is); return message; }
public JournalCommand<?> load(Location location) throws IOException { DataByteArrayInputStream is = new DataByteArrayInputStream(journal.read(location)); byte readByte = is.readByte(); KahaEntryType type = KahaEntryType.valueOf(readByte); if (type == null) { throw new IOException("Could not load journal record. Invalid location: " + location); } JournalCommand<?> message = (JournalCommand<?>) type.createMessage(); message.mergeFramed(is); return message; }
/** * Loads a previously stored JournalMessage * * @param location * @return * @throws IOException */ public JournalCommand<?> load(Location location) throws IOException { long start = System.currentTimeMillis(); ByteSequence data = journal.read(location); long end = System.currentTimeMillis(); if( LOG_SLOW_ACCESS_TIME>0 && end-start > LOG_SLOW_ACCESS_TIME) { if (LOG.isInfoEnabled()) { LOG.info("Slow KahaDB access: Journal read took: "+(end-start)+" ms"); } } DataByteArrayInputStream is = new DataByteArrayInputStream(data); byte readByte = is.readByte(); KahaEntryType type = KahaEntryType.valueOf(readByte); if( type == null ) { try { is.close(); } catch (IOException e) {} throw new IOException("Could not load journal record, null type information from: " + readByte + " at location: "+location); } JournalCommand<?> message = (JournalCommand<?>)type.createMessage(); message.mergeFramed(is); return message; }
/** * Loads a previously stored JournalMessage * * @param location * @return * @throws IOException */ public JournalCommand<?> load(Location location) throws IOException { long start = System.currentTimeMillis(); ByteSequence data = journal.read(location); long end = System.currentTimeMillis(); if( LOG_SLOW_ACCESS_TIME>0 && end-start > LOG_SLOW_ACCESS_TIME) { if (LOG.isInfoEnabled()) { LOG.info("Slow KahaDB access: Journal read took: "+(end-start)+" ms"); } } DataByteArrayInputStream is = new DataByteArrayInputStream(data); byte readByte = is.readByte(); KahaEntryType type = KahaEntryType.valueOf(readByte); if( type == null ) { try { is.close(); } catch (IOException e) {} throw new IOException("Could not load journal record, null type information from: " + readByte + " at location: "+location); } JournalCommand<?> message = (JournalCommand<?>)type.createMessage(); message.mergeFramed(is); return message; }
public JournalCommand<?> load(Location location) throws IOException { DataByteArrayInputStream is = new DataByteArrayInputStream(journal.read(location)); byte readByte = is.readByte(); KahaEntryType type = KahaEntryType.valueOf(readByte); if (type == null) { throw new IOException("Could not load journal record. Invalid location: " + location); } JournalCommand<?> message = (JournalCommand<?>) type.createMessage(); message.mergeFramed(is); return message; }
public JournalCommand<?> load(Location location) throws IOException { DataByteArrayInputStream is = new DataByteArrayInputStream(journal.read(location)); byte readByte = is.readByte(); KahaEntryType type = KahaEntryType.valueOf(readByte); if (type == null) { throw new IOException("Could not load journal record. Invalid location: " + location); } JournalCommand<?> message = (JournalCommand<?>) type.createMessage(); message.mergeFramed(is); return message; }
/** * Loads a previously stored JournalMessage * * @param location * @return * @throws IOException */ public JournalCommand<?> load(Location location) throws IOException { long start = System.currentTimeMillis(); ByteSequence data = journal.read(location); long end = System.currentTimeMillis(); if( LOG_SLOW_ACCESS_TIME>0 && end-start > LOG_SLOW_ACCESS_TIME) { if (LOG.isInfoEnabled()) { LOG.info("Slow KahaDB access: Journal read took: "+(end-start)+" ms"); } } DataByteArrayInputStream is = new DataByteArrayInputStream(data); byte readByte = is.readByte(); KahaEntryType type = KahaEntryType.valueOf(readByte); if( type == null ) { try { is.close(); } catch (IOException e) {} throw new IOException("Could not load journal record, null type information from: " + readByte + " at location: "+location); } JournalCommand<?> message = (JournalCommand<?>)type.createMessage(); message.mergeFramed(is); return message; }
/** * Loads a previously stored JournalMessage * * @param location * @return * @throws IOException */ public JournalCommand<?> load(Location location) throws IOException { ByteSequence data = journal.read(location); DataByteArrayInputStream is = new DataByteArrayInputStream(data); byte readByte = is.readByte(); KahaEntryType type = KahaEntryType.valueOf(readByte); if( type == null ) { throw new IOException("Could not load journal record. Invalid location: "+location); } JournalCommand<?> message = (JournalCommand<?>)type.createMessage(); message.mergeFramed(is); return message; }
/** * Loads a previously stored JournalMessage * * @param location * The location of the journal command to read. * * @return a new un-marshaled JournalCommand instance. * * @throws IOException if an error occurs reading the stored command. */ protected JournalCommand<?> load(Location location) throws IOException { ByteSequence data = journal.read(location); DataByteArrayInputStream is = new DataByteArrayInputStream(data); byte readByte = is.readByte(); KahaEntryType type = KahaEntryType.valueOf(readByte); if (type == null) { try { is.close(); } catch (IOException e) { } throw new IOException("Could not load journal record. Invalid location: " + location); } JournalCommand<?> message = (JournalCommand<?>)type.createMessage(); message.mergeFramed(is); return message; }
/** * Loads a previously stored JournalMessage * * @param location * The location of the journal command to read. * * @return a new un-marshaled JournalCommand instance. * * @throws IOException if an error occurs reading the stored command. */ protected JournalCommand<?> load(Location location) throws IOException { ByteSequence data = journal.read(location); DataByteArrayInputStream is = new DataByteArrayInputStream(data); byte readByte = is.readByte(); KahaEntryType type = KahaEntryType.valueOf(readByte); if (type == null) { try { is.close(); } catch (IOException e) { } throw new IOException("Could not load journal record. Invalid location: " + location); } JournalCommand<?> message = (JournalCommand<?>)type.createMessage(); message.mergeFramed(is); return message; }
/** * Loads a previously stored JournalMessage * * @param location * The location of the journal command to read. * * @return a new un-marshaled JournalCommand instance. * * @throws IOException if an error occurs reading the stored command. */ protected JournalCommand<?> load(Location location) throws IOException { ByteSequence data = journal.read(location); DataByteArrayInputStream is = new DataByteArrayInputStream(data); byte readByte = is.readByte(); KahaEntryType type = KahaEntryType.valueOf(readByte); if (type == null) { try { is.close(); } catch (IOException e) { } throw new IOException("Could not load journal record. Invalid location: " + location); } JournalCommand<?> message = (JournalCommand<?>)type.createMessage(); message.mergeFramed(is); return message; }