@Test public void testRemoveBufferLinesBefore() { LoggingBuffer loggingBuffer = new LoggingBuffer( 100 ); for ( int i = 0; i < 40; i++ ) { KettleLoggingEvent event = new KettleLoggingEvent(); event.setMessage( new LogMessage( "test", LogLevel.BASIC ) ); event.setTimeStamp( i ); loggingBuffer.addLogggingEvent( event ); } loggingBuffer.removeBufferLinesBefore( 20 ); Assert.assertEquals( 20, loggingBuffer.size() ); }
public void removeBufferLinesBefore( long minTimeBoundary ) { Set<BufferLine> linesToRemove = new HashSet<>(); lock.writeLock().lock(); try { for ( BufferLine bufferLine : buffer ) { if ( bufferLine.getEvent().timeStamp < minTimeBoundary ) { linesToRemove.add( bufferLine ); } else { break; } } buffer.removeAll( linesToRemove ); } finally { lock.writeLock().unlock(); } }
LoggingBuffer { public void removeBufferLinesBefore( long minTimeBoundary ) { Set<BufferLine> linesToRemove = new HashSet<>(); lock.writeLock().lock(); try { for ( BufferLine bufferLine : buffer ) { if ( bufferLine.getEvent().timeStamp < minTimeBoundary ) { linesToRemove.add( bufferLine ); } else { break; } } buffer.removeAll( linesToRemove ); } finally { lock.writeLock().unlock(); } } }
LoggingBuffer { public void removeBufferLinesBefore( long minTimeBoundary ) { Set<BufferLine> linesToRemove = new HashSet<>(); lock.writeLock().lock(); try { for ( BufferLine bufferLine : buffer ) { if ( bufferLine.getEvent().timeStamp < minTimeBoundary ) { linesToRemove.add( bufferLine ); } else { break; } } buffer.removeAll( linesToRemove ); } finally { lock.writeLock().unlock(); } } LoggingBuffer( int bufferSize ); }
LoggingBuffer { public void removeBufferLinesBefore( long minTimeBoundary ) { Set<BufferLine> linesToRemove = new HashSet<>(); lock.writeLock().lock(); try { for ( BufferLine bufferLine : buffer ) { if ( bufferLine.getEvent().timeStamp < minTimeBoundary ) { linesToRemove.add( bufferLine ); } else { break; } } buffer.removeAll( linesToRemove ); } finally { lock.writeLock().unlock(); } } LoggingBuffer( int bufferSize ); int getLastBufferLineNr(); List<KettleLoggingEvent> getLogBufferFromTo( List<String> channelId, boolean includeGeneral, int from,
                                                      int to ); List<KettleLoggingEvent> getLogBufferFromTo( String parentLogChannelId, boolean includeGeneral, int from,
                                                      int to ); StringBuffer getBuffer( String parentLogChannelId, boolean includeGeneral, int startLineNr, int endLineNr ); StringBuffer getBuffer( String parentLogChannelId, boolean includeGeneral ); StringBuffer getBuffer( String parentLogChannelId, boolean includeGeneral, int startLineNr ); StringBuffer getBuffer(); void close(); void doAppend( KettleLoggingEvent event ); void setName( String name ); String getName(); void setLayout( KettleLogLayout layout ); KettleLogLayout getLayout(); boolean requiresLayout(); void clear(); int getMaxNrLines(); void setMaxNrLines( int maxNrLines ); int getNrLines(); void removeChannelFromBuffer( String id ); int size(); void removeGeneralMessages(); @Deprecated @VisibleForTesting Iterator<BufferLine> getBufferIterator(); @Deprecated String dump(); @Deprecated void removeBufferLines( List<BufferLine> linesToRemove ); @Deprecated List<BufferLine> getBufferLinesBefore( long minTimeBoundary ); void removeBufferLinesBefore( long minTimeBoundary ); void addLogggingEvent( KettleLoggingEvent loggingEvent ); void addLoggingEventListener( KettleLoggingEventListener listener ); void removeLoggingEventListener( KettleLoggingEventListener listener ); }
LoggingBuffer { public void removeBufferLinesBefore( long minTimeBoundary ) { Set<BufferLine> linesToRemove = new HashSet<>(); lock.writeLock().lock(); try { for ( BufferLine bufferLine : buffer ) { if ( bufferLine.getEvent().timeStamp < minTimeBoundary ) { linesToRemove.add( bufferLine ); } else { break; } } buffer.removeAll( linesToRemove ); } finally { lock.writeLock().unlock(); } } LoggingBuffer( int bufferSize ); int getLastBufferLineNr(); List<KettleLoggingEvent> getLogBufferFromTo( List<String> channelId, boolean includeGeneral, int from,
                                                      int to ); List<KettleLoggingEvent> getLogBufferFromTo( String parentLogChannelId, boolean includeGeneral, int from,
                                                      int to ); StringBuffer getBuffer( String parentLogChannelId, boolean includeGeneral, int startLineNr, int endLineNr ); StringBuffer getBuffer( String parentLogChannelId, boolean includeGeneral ); StringBuffer getBuffer( String parentLogChannelId, boolean includeGeneral, int startLineNr ); StringBuffer getBuffer(); void close(); void doAppend( KettleLoggingEvent event ); void setName( String name ); String getName(); void setLayout( KettleLogLayout layout ); KettleLogLayout getLayout(); boolean requiresLayout(); void clear(); int getMaxNrLines(); void setMaxNrLines( int maxNrLines ); int getNrLines(); void removeChannelFromBuffer( String id ); int size(); void removeGeneralMessages(); @Deprecated @VisibleForTesting Iterator<BufferLine> getBufferIterator(); @Deprecated String dump(); @Deprecated void removeBufferLines( List<BufferLine> linesToRemove ); @Deprecated List<BufferLine> getBufferLinesBefore( long minTimeBoundary ); void removeBufferLinesBefore( long minTimeBoundary ); void addLogggingEvent( KettleLoggingEvent loggingEvent ); void addLoggingEventListener( KettleLoggingEventListener listener ); void removeLoggingEventListener( KettleLoggingEventListener listener );  }