public abstract class AbstractStreamCoordinatorClient extends com.google.common.util.concurrent.AbstractIdleService implements StreamCoordinatorClient
StreamCoordinatorClient.| Constructor and Description |
|---|
AbstractStreamCoordinatorClient() |
| Modifier and Type | Method and Description |
|---|---|
Cancellable |
addListener(Id.Stream streamId,
StreamPropertyListener listener)
Receives event for changes in stream properties.
|
protected abstract <T> PropertyStore<T> |
createPropertyStore(Codec<T> codec)
Creates a
PropertyStore. |
StreamConfig |
createStream(Id.Stream streamId,
Callable<StreamConfig> action)
Creates a stream by performing the given action.
|
void |
deleteStream(Id.Stream streamId,
Runnable action)
Deletes a stream by performing the given action.
|
protected abstract void |
doShutDown()
Stops the service.
|
protected abstract void |
doStartUp()
Starts the service.
|
<T> T |
exclusiveAction(Id.Stream streamId,
Callable<T> action)
Performs an action on a stream while holding the lock for the stream.
|
protected abstract Lock |
getLock(Id.Stream streamId)
Returns a
Lock for performing exclusive operation for the given stream. |
protected void |
shutDown() |
protected void |
startUp() |
protected abstract void |
streamCreated(Id.Stream streamId)
Gets invoked when a stream of the given name is created.
|
protected abstract void |
streamDeleted(Id.Stream streamId)
Gets invoked when a stream is deleted.
|
void |
updateProperties(Id.Stream streamId,
Callable<CoordinatorStreamProperties> action)
Updates the stream properties by performing the given action.
|
addListener, executor, isRunning, start, startAndWait, state, stop, stopAndWait, toStringprotected abstract void doStartUp()
throws Exception
Exception - when starting of the service failedprotected abstract void doShutDown()
throws Exception
Exception - when stopping the service could not be performedprotected abstract <T> PropertyStore<T> createPropertyStore(Codec<T> codec)
PropertyStore.T - Type of the propertycodec - Codec for the property stored in the property storePropertyStore.protected abstract Lock getLock(Id.Stream streamId)
Lock for performing exclusive operation for the given stream.protected abstract void streamCreated(Id.Stream streamId)
protected abstract void streamDeleted(Id.Stream streamId)
public StreamConfig createStream(Id.Stream streamId, Callable<StreamConfig> action) throws Exception
StreamCoordinatorClientcreateStream in interface StreamCoordinatorClientstreamId - name of the streamaction - action to perform. If a new stream is created, it should returns a StreamConfig representing
the configuration of the new stream; otherwise null should be returned.StreamConfig as returned by the actionException - if the action throws Exceptionpublic void updateProperties(Id.Stream streamId, Callable<CoordinatorStreamProperties> action) throws Exception
StreamCoordinatorClientupdateProperties in interface StreamCoordinatorClientstreamId - name of the streamaction - action to perform. It should returns a CoordinatorStreamProperties containing information
about the update properties.Exception - if failed to update propertiespublic void deleteStream(Id.Stream streamId, Runnable action) throws Exception
StreamCoordinatorClientdeleteStream in interface StreamCoordinatorClientstreamId - name of the streamaction - action to perform.Exception - if the action throws Exceptionpublic <T> T exclusiveAction(Id.Stream streamId, Callable<T> action) throws Exception
StreamCoordinatorClientexclusiveAction in interface StreamCoordinatorClientstreamId - name of the streamaction - action to perform.Exception - if the action throws Exceptionpublic Cancellable addListener(Id.Stream streamId, StreamPropertyListener listener)
StreamCoordinatorClientaddListener in interface StreamCoordinatorClientstreamId - name of the streamlistener - listener to get called when there is change in stream properties.Cancellable to cancel the watchprotected final void startUp()
throws Exception
startUp in class com.google.common.util.concurrent.AbstractIdleServiceExceptionCopyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.