Interface Publisher<V>
- Type Parameters:
- V- the type of notification received by subscribers
- All Known Subinterfaces:
- Processor<I,,- O> - Processor.Iso<V>,- Processor.Transactional<I,,- O> - Processor.TransactionalIso<V>,- Publisher.Cached<V>,- ValueReference<T,- N> 
public interface Publisher<V>
Something that can publish events.
 
Each subscriber is responsible for removing itself from this stream, by using the Disposable returned upon subscription.
- Since:
- 4.0.0
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA publisher that caches the last value received.
- 
Method SummaryModifier and TypeMethodDescriptiondefault Publisher.Cached<V>cache()Return a publisher that will track its most recent value.default Publisher.Cached<V>Create a cached publisher with an initial value.execute(CheckedSupplier<V, E> action) Execute an action returning a single value on the commonForkJoinPool, and pass the result to any subscribers.execute(CheckedSupplier<V, E> action, Executor executor) Execute an action returning a single value on the providedExecutor, and pass the result to any subscribers.executor()Get the executor used to handle published events.booleanReturn whether or not this Publisher has any subscribers.default <R> Publisher<R>map(CheckedFunction<? super V, ? extends R, TransactionFailedException> mapper) Create a new publisher that will transform events published.subscribe(Subscriber<? super V> subscriber) Subscribe to updates from this Publisher.
- 
Method Details- 
executeExecute an action returning a single value on the commonForkJoinPool, and pass the result to any subscribers.Subscribers who only begin subscribing after the operation has been completed will receive the result of the operation. - Type Parameters:
- V- returned value type
- E- exception thrown
- Parameters:
- action- the action to perform
- Returns:
- a publisher
- Since:
- 4.0.0
 
- 
executestatic <V,E extends Exception> Publisher<V> execute(CheckedSupplier<V, E> action, Executor executor) Execute an action returning a single value on the providedExecutor, and pass the result to any subscribers.Subscribers who only begin subscribing after the operation has been completed will receive the result of the operation. - Type Parameters:
- V- returned value type
- E- exception thrown
- Parameters:
- action- the action to perform
- executor- the executor to perform this operation on
- Returns:
- a publisher
- Since:
- 4.0.0
 
- 
subscribeSubscribe to updates from this Publisher. If this is already closed, the Subscriber will receive an error event with an IllegalStateException, and the returnedDisposablewill be a no-op.- Parameters:
- subscriber- the listener to register
- Returns:
- a disposable that can be used to cancel this subscription
- Since:
- 4.0.0
 
- 
hasSubscribersboolean hasSubscribers()Return whether or not this Publisher has any subscribers.In a concurrent environment, this value could change from the time of calling. - Returns:
- if there are subscribers
- Since:
- 4.0.0
 
- 
mapdefault <R> Publisher<R> map(CheckedFunction<? super V, ? extends R, TransactionFailedException> mapper) Create a new publisher that will transform events published.- Type Parameters:
- R- output value type
- Parameters:
- mapper- transformer function
- Returns:
- a new publisher
- Since:
- 4.0.0
 
- 
cacheReturn a publisher that will track its most recent value. The provided processor won't have a value until one is submitted to this publisher.- Returns:
- a publisher based on this one
- Since:
- 4.0.0
 
- 
cacheCreate a cached publisher with an initial value.- Parameters:
- initialValue- value to initialize the returned publisher with
- Returns:
- publisher that will cache future responses
- Since:
- 4.0.0
 
- 
executorGet the executor used to handle published events.- Returns:
- the executor
- Since:
- 4.0.0
 
 
-