/** * Create the central log store with optional limitation to the size * * @param maxSize * the maximum size * @param maxLogTimeoutMinutes * The maximum time that a log line times out in Minutes. */ private KettleLogStore( int maxSize, int maxLogTimeoutMinutes, boolean redirectStdOut, boolean redirectStdErr ) { this.appender = new LoggingBuffer( maxSize ); replaceLogCleaner( maxLogTimeoutMinutes ); if ( redirectStdOut ) { System.setOut( new LoggingPrintStream( OriginalSystemOut ) ); } if ( redirectStdErr ) { System.setErr( new LoggingPrintStream( OriginalSystemErr ) ); } }
@Test public void shouldNotFailProcessingEventsUnderHighContention() throws Exception { int modifiersAmount = 100; int readersAmount = 100; buffer = new LoggingBuffer( 5000 ); AtomicBoolean condition = new AtomicBoolean( true ); List<StopOnErrorCallable<?>> modifiers = new ArrayList<>(); for ( int i = 0; i < modifiersAmount; i++ ) { modifiers.add( new Appender( condition ) ); } List<StopOnErrorCallable<?>> readers = new ArrayList<>(); for ( int i = 0; i < readersAmount; i++ ) { readers.add( new Reader( condition ) ); } ConcurrencyTestRunner<?, ?> runner = new ConcurrencyTestRunner<>( modifiers, readers, condition, 5000 ); runner.runConcurrentTest(); runner.checkNoExceptionRaised(); }