public static <TYPE, EXCEPTION extends Exception> TYPE awaitEx( ThrowingSupplier<TYPE,? extends EXCEPTION> supplier, ThrowingPredicate<TYPE, ? extends EXCEPTION> predicate, long timeout, TimeUnit timeoutUnit ) throws TimeoutException, EXCEPTION { Suppliers.ThrowingCapturingSupplier<TYPE,EXCEPTION> composed = Suppliers.compose( supplier, predicate ); awaitEx( composed, timeout, timeoutUnit ); return composed.lastInput(); }
public static <TYPE> TYPE await( Supplier<TYPE> supplier, Predicate<TYPE> predicate, long timeout, TimeUnit timeoutUnit ) throws TimeoutException { return awaitEx( throwingSupplier( supplier ), throwingPredicate( predicate ), timeout, timeoutUnit ); }
@Override public ResourceIterator<Path> iterator() { TraverserIterator traverserIterator = traverserIteratorFactory.newInstance(); lastIterator = traverserIterator; return traverserIterator; }
@Override public void shutdown() throws Exception { action.apply(); } };
public DynamicTaskExecutor( int initialProcessorCount, int maxProcessorCount, int maxQueueSize, ParkStrategy parkStrategy, String processorThreadNamePrefix ) { this( initialProcessorCount, maxProcessorCount, maxQueueSize, parkStrategy, processorThreadNamePrefix, Suppliers.singleton( null ) ); }
@Override public URL validateURLAccess( URL url ) throws URLAccessValidationError { return urlValidator.apply( url ); }
@Test void correctlyReportInitialisedSuppliers() { Suppliers.Lazy<Object> lazySingleton = Suppliers.lazySingleton( Object::new ); lazySingleton.get(); assertTrue( lazySingleton.isInitialised() ); } }
@Override protected T fetchNextOrNull() throws EX { return supplier.get(); } };
public RecordDataAssembler( Supplier<RECORD> factory ) { this( factory, Predicates.alwaysTrue() ); }
@Test void correctlyReportNotInitialisedSuppliers() { Suppliers.Lazy<Object> lazySingleton = Suppliers.lazySingleton( Object::new ); assertFalse( lazySingleton.isInitialised() ); }
public static <EXCEPTION extends Exception> void awaitEx( ThrowingSupplier<Boolean,EXCEPTION> condition, long timeout, TimeUnit unit ) throws TimeoutException, EXCEPTION { awaitEx( condition, timeout, unit, DEFAULT_POLL_INTERVAL, TimeUnit.MILLISECONDS ); }
/** * Creates a {@link FormattedLog} instance that writes messages to {@link OutputStream}s obtained from the specified * {@link Supplier}. The OutputStream is obtained from the Supplier before every log message is written. * * @param outSupplier A supplier for an output stream to write to * @return A {@link FormattedLog} instance */ public FormattedLog toOutputStream( Supplier<OutputStream> outSupplier ) { return toPrintWriter( Suppliers.adapted( outSupplier, OUTPUT_STREAM_CONVERTER ) ); }
public static <T, E extends Exception> ThrowingCapturingSupplier<T,E> compose( final ThrowingSupplier<T,? extends E> input, final ThrowingPredicate<T,? extends E> predicate ) { return new ThrowingCapturingSupplier<>( input, predicate ); }
protected R create() { return factory.newInstance(); }
public static <TYPE, EXCEPTION extends Exception> TYPE awaitEx( ThrowingSupplier<TYPE,EXCEPTION> supplier, ThrowingPredicate<TYPE,EXCEPTION> predicate, long timeout, TimeUnit timeoutUnit, long pollInterval, TimeUnit pollUnit ) throws TimeoutException, EXCEPTION { Suppliers.ThrowingCapturingSupplier<TYPE,EXCEPTION> composed = Suppliers.compose( supplier, predicate ); awaitEx( composed, timeout, timeoutUnit, pollInterval, pollUnit ); return composed.lastInput(); }
public static <TYPE> TYPE await( Supplier<TYPE> supplier, Predicate<TYPE> predicate, long timeout, TimeUnit timeoutUnit, long pollInterval, TimeUnit pollUnit ) throws TimeoutException { return awaitEx( supplier::get, predicate::test, timeout, timeoutUnit, pollInterval, pollUnit ); }
public FileSystemAbstractionInterruptionTest( @SuppressWarnings( "UnusedParameters" ) String name, Factory<FileSystemAbstraction> factory ) { fs = factory.newInstance(); }
public static void await( BooleanSupplier condition, long timeout, TimeUnit timeoutUnit, long pollInterval, TimeUnit pollUnit ) throws TimeoutException { awaitEx( condition::getAsBoolean, timeout, timeoutUnit, pollInterval, pollUnit ); }
public static void await( BooleanSupplier condition, long timeout, TimeUnit unit ) throws TimeoutException { awaitEx( condition::getAsBoolean, timeout, unit ); }