Interface ClientMetaObserver
Defines coprocessor hooks for interacting operations for ClientMetaService which is responsible
for ZooKeeperless HBase service discovery.
Since most implementations will be interested in only a subset of hooks, this class uses 'default' functions to avoid having to add unnecessary overrides. When the functions are non-empty, it's simply to satisfy the compiler by returning value of expected (non-void) type. It is done in a way that these default definitions act as no-op. So our suggestion to implementation would be to not call these 'default' methods from overrides.
Since most implementations will be interested in only a subset of hooks, this class uses 'default' functions to avoid having to add unnecessary overrides. When the functions are non-empty, it's simply to satisfy the compiler by returning value of expected (non-void) type. It is done in a way that these default definitions act as no-op. So our suggestion to implementation would be to not call these 'default' methods from overrides.
Exception Handling
For all functions, exception handling is done as follows:- Exceptions of type
IOExceptionare reported back to client. - For any other kind of exception:
- If the configuration
CoprocessorHost.ABORT_ON_ERROR_KEYis set to true, then the server aborts. - Otherwise, coprocessor is removed from the server and
DoNotRetryIOExceptionis returned to the client.
- If the configuration
-
Method Summary
Modifier and TypeMethodDescriptiondefault ServerNamepostGetActiveMaster(ObserverContext<ClientMetaCoprocessorEnvironment> ctx, ServerName serverName) Called after we got the active master.default List<ServerName>postGetBootstrapNodes(ObserverContext<ClientMetaCoprocessorEnvironment> ctx, List<ServerName> bootstrapNodes) Called after we got bootstrap nodes.default StringpostGetClusterId(ObserverContext<ClientMetaCoprocessorEnvironment> ctx, String clusterId) Called after we got the cluster ID.default Map<ServerName,Boolean> postGetMasters(ObserverContext<ClientMetaCoprocessorEnvironment> ctx, Map<ServerName, Boolean> serverNames) Called after we got the master servers.default List<HRegionLocation>postGetMetaLocations(ObserverContext<ClientMetaCoprocessorEnvironment> ctx, List<HRegionLocation> metaLocations) Called after we got the meta region locations.default voidCalled before getting the active master.default voidCalled before getting bootstrap nodes.default voidCalled before getting the cluster ID.default voidCalled before getting the master servers.default voidCalled before getting the meta region locations.
-
Method Details
-
preGetClusterId
default void preGetClusterId(ObserverContext<ClientMetaCoprocessorEnvironment> ctx) throws IOException Called before getting the cluster ID.- Parameters:
ctx- the environment to interact with the framework- Throws:
IOException
-
postGetClusterId
default String postGetClusterId(ObserverContext<ClientMetaCoprocessorEnvironment> ctx, String clusterId) throws IOException Called after we got the cluster ID.- Parameters:
ctx- the environment to interact with the frameworkclusterId- the actual cluster ID- Returns:
- the cluster ID which is returned to the client.
- Throws:
IOException
-
preGetActiveMaster
default void preGetActiveMaster(ObserverContext<ClientMetaCoprocessorEnvironment> ctx) throws IOException Called before getting the active master.- Parameters:
ctx- the environment to interact with the framework- Throws:
IOException
-
postGetActiveMaster
default ServerName postGetActiveMaster(ObserverContext<ClientMetaCoprocessorEnvironment> ctx, ServerName serverName) throws IOException Called after we got the active master.- Parameters:
ctx- the environment to interact with the frameworkserverName- the actual active master address. It can benullif there is no active master.- Returns:
- the active master address which is returned to the client. It can be
null. - Throws:
IOException
-
preGetMasters
default void preGetMasters(ObserverContext<ClientMetaCoprocessorEnvironment> ctx) throws IOException Called before getting the master servers.- Parameters:
ctx- the environment to interact with the framework- Throws:
IOException
-
postGetMasters
default Map<ServerName,Boolean> postGetMasters(ObserverContext<ClientMetaCoprocessorEnvironment> ctx, Map<ServerName, Boolean> serverNames) throws IOExceptionCalled after we got the master servers.- Parameters:
ctx- the environment to interact with the frameworkserverNames- the actual master servers addresses and active statuses- Returns:
- the master servers addresses and active statuses which are returned to the client.
- Throws:
IOException
-
preGetBootstrapNodes
default void preGetBootstrapNodes(ObserverContext<ClientMetaCoprocessorEnvironment> ctx) throws IOException Called before getting bootstrap nodes.- Parameters:
ctx- the environment to interact with the framework- Throws:
IOException
-
postGetBootstrapNodes
default List<ServerName> postGetBootstrapNodes(ObserverContext<ClientMetaCoprocessorEnvironment> ctx, List<ServerName> bootstrapNodes) throws IOException Called after we got bootstrap nodes.- Parameters:
ctx- the environment to interact with the frameworkbootstrapNodes- the actual bootstrap nodes- Returns:
- the bootstrap nodes which are returned to the client.
- Throws:
IOException
-
preGetMetaLocations
default void preGetMetaLocations(ObserverContext<ClientMetaCoprocessorEnvironment> ctx) throws IOException Called before getting the meta region locations.- Parameters:
ctx- the environment to interact with the framework- Throws:
IOException
-
postGetMetaLocations
default List<HRegionLocation> postGetMetaLocations(ObserverContext<ClientMetaCoprocessorEnvironment> ctx, List<HRegionLocation> metaLocations) throws IOException Called after we got the meta region locations.- Parameters:
ctx- the environment to interact with the frameworkmetaLocations- the actual meta region locations- Returns:
- the meta region locations which are returned to the client.
- Throws:
IOException
-