Package org.factcast.core.subscription
Class SubscriptionImpl<T>
- java.lang.Object
-
- org.factcast.core.subscription.SubscriptionImpl<T>
-
- Type Parameters:
T
-
- All Implemented Interfaces:
AutoCloseable
,Subscription
public class SubscriptionImpl<T> extends Object implements Subscription
Implements a subscription and offers notifyX methods for the Fact Supplier to write to.- Author:
-
-
Constructor Summary
Constructors Constructor Description SubscriptionImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Subscription
awaitCatchup()
blocks until Catchup or Cancelled event receivedSubscription
awaitCatchup(long waitTimeInMillis)
blocks until Catchup or Cancelled event receivedSubscription
awaitComplete()
blocks until Complete or Cancelled event receivedSubscription
awaitComplete(long waitTimeInMillis)
blocks until Complete or Cancelled event receivedvoid
close()
void
notifyCatchup()
void
notifyComplete()
void
notifyElement(T e)
void
notifyError(Throwable e)
static <T> SubscriptionImpl<T>
on(@NonNull GenericObserver<T> o)
SubscriptionImpl<T>
onClose(Runnable e)
-
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
awaitCatchup
public Subscription awaitCatchup() throws SubscriptionCancelledException
Description copied from interface:Subscription
blocks until Catchup or Cancelled event received- Specified by:
awaitCatchup
in interfaceSubscription
- Returns:
- this for fluency
- Throws:
SubscriptionCancelledException
- if Subscription was cancelled before or during the wait
-
awaitCatchup
public Subscription awaitCatchup(long waitTimeInMillis) throws SubscriptionCancelledException, TimeoutException
Description copied from interface:Subscription
blocks until Catchup or Cancelled event received- Specified by:
awaitCatchup
in interfaceSubscription
- Returns:
- this for fluency
- Throws:
SubscriptionCancelledException
TimeoutException
- if no relevant event was received in time
-
awaitComplete
public Subscription awaitComplete() throws SubscriptionCancelledException
Description copied from interface:Subscription
blocks until Complete or Cancelled event received- Specified by:
awaitComplete
in interfaceSubscription
- Returns:
- Throws:
SubscriptionCancelledException
-
awaitComplete
public Subscription awaitComplete(long waitTimeInMillis) throws SubscriptionCancelledException, TimeoutException
Description copied from interface:Subscription
blocks until Complete or Cancelled event received- Specified by:
awaitComplete
in interfaceSubscription
- Returns:
- this
- Throws:
SubscriptionCancelledException
TimeoutException
- if no relevant event was received in time
-
notifyCatchup
public void notifyCatchup()
-
notifyComplete
public void notifyComplete()
-
notifyError
public void notifyError(Throwable e)
-
notifyElement
public void notifyElement(@NonNull T e)
-
onClose
public SubscriptionImpl<T> onClose(Runnable e)
-
on
public static <T> SubscriptionImpl<T> on(@NonNull @NonNull GenericObserver<T> o)
-
-