@Override public void setMaxOpSize(int maxOpSize) { this.maxOpSize = maxOpSize; if (reader != null) { reader.setMaxOpSize(maxOpSize); } }
private void init() throws LogHeaderCorruptException, IOException { Preconditions.checkState(state == State.UNINIT); BufferedInputStream bin = null; try { fStream = log.getInputStream(); bin = new BufferedInputStream(fStream); tracker = new FSEditLogLoader.PositionTrackingInputStream(bin); dataIn = new DataInputStream(tracker); try { logVersion = readLogVersion(dataIn); } catch (EOFException eofe) { throw new LogHeaderCorruptException("No header found in log"); } if (LayoutVersion.supports(Feature.ADD_LAYOUT_FLAGS, logVersion)) { try { LayoutFlags.read(dataIn); } catch (EOFException eofe) { throw new LogHeaderCorruptException("EOF while reading layout " + "flags from log"); } } reader = new FSEditLogOp.Reader(dataIn, tracker, logVersion); reader.setMaxOpSize(maxOpSize); state = State.OPEN; } finally { if (reader == null) { IOUtils.cleanup(LOG, dataIn, tracker, bin, fStream); state = State.CLOSED; } } }