public class ExhibitorEnsembleProvider extends Object implements EnsembleProvider
Constructor and Description |
---|
ExhibitorEnsembleProvider(Exhibitors exhibitors,
ExhibitorRestClient restClient,
String restUriPath,
int pollingMs,
RetryPolicy retryPolicy) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Curator will call this method when
CuratorZookeeperClient.close() is called |
String |
getConnectionString()
Return the current connection string to use.
|
protected void |
poll() |
void |
pollForInitialEnsemble()
Can be called prior to starting the Curator instance to set the current connection string
|
void |
setExhibitors(Exhibitors newExhibitors)
Change the set of exhibitors to poll
|
void |
start()
Curator will call this method when
CuratorZookeeperClient.start() is
called |
public ExhibitorEnsembleProvider(Exhibitors exhibitors, ExhibitorRestClient restClient, String restUriPath, int pollingMs, RetryPolicy retryPolicy)
exhibitors
- the current set of exhibitor instances (can be changed later via setExhibitors(Exhibitors)
)restClient
- the rest client to use (use DefaultExhibitorRestClient
for most cases)restUriPath
- the path of the REST call used to get the server set. Usually: /exhibitor/v1/cluster/list
pollingMs
- how ofter to poll the exhibitors for the listretryPolicy
- retry policy to use when connecting to the exhibitorspublic void setExhibitors(Exhibitors newExhibitors)
newExhibitors
- new setpublic void pollForInitialEnsemble() throws Exception
Exception
- errorspublic void start() throws Exception
EnsembleProvider
CuratorZookeeperClient.start()
is
calledstart
in interface EnsembleProvider
Exception
- errorspublic void close() throws IOException
EnsembleProvider
CuratorZookeeperClient.close()
is calledclose
in interface Closeable
close
in interface AutoCloseable
close
in interface EnsembleProvider
IOException
- errorspublic String getConnectionString()
EnsembleProvider
getConnectionString
in interface EnsembleProvider
ZooKeeper.ZooKeeper(String, int, Watcher)
etc.)protected void poll()
Copyright © 2011–2019 The Apache Software Foundation. All rights reserved.