Java Code Examples for reactor.core.publisher.Signal#isOnComplete()
The following examples show how to use
reactor.core.publisher.Signal#isOnComplete() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventBroker.java From linstor-server with GNU General Public License v3.0 | 5 votes |
private <T> byte[] serializeSignal( Integer peerWatchId, EventSerializer.Serializer<T> eventSerializer, String eventName, ObjectSignal<T> objectSignal ) { EventIdentifier eventIdentifier = new EventIdentifier(eventName, objectSignal.getObjectIdentifier()); Signal<T> signal = objectSignal.getSignal(); CommonSerializer.CommonSerializerBuilder builder = commonSerializer.onewayBuilder(ApiConsts.API_EVENT); if (signal.isOnNext()) { builder .event(peerWatchId, eventIdentifier, InternalApiConsts.EVENT_STREAM_VALUE) .bytes(eventSerializer.writeEventValue(signal.get())); } else if (signal.isOnComplete()) { builder.event(peerWatchId, eventIdentifier, InternalApiConsts.EVENT_STREAM_CLOSE_REMOVED); } else if (signal.isOnError() && signal.getThrowable() instanceof PeerNotConnectedException) { builder.event(peerWatchId, eventIdentifier, InternalApiConsts.EVENT_STREAM_CLOSE_NO_CONNECTION); } else { throw new ImplementationError("Unexpected event signal " + signal); } return builder.build(); }
Example 2
Source File: DefaultStepVerifierBuilder.java From reactor-core with Apache License 2.0 | 4 votes |
/** Cancels this subscriber if the actual signal is null or not a complete/error */ final void maybeCancel(@Nullable Signal<T> actualSignal) { if (actualSignal == null || (!actualSignal.isOnComplete() && !actualSignal.isOnError())) { cancel(); } }