Package org.apache.hadoop.ha.protocolPB
Class HAServiceProtocolClientSideTranslatorPB
java.lang.Object
org.apache.hadoop.ha.protocolPB.HAServiceProtocolClientSideTranslatorPB
- All Implemented Interfaces:
Closeable,AutoCloseable,HAServiceProtocol,ProtocolTranslator
@Private
@Stable
public class HAServiceProtocolClientSideTranslatorPB
extends Object
implements HAServiceProtocol, Closeable, ProtocolTranslator
This class is the client side translator to translate the requests made on
HAServiceProtocol interfaces to the RPC server implementing
HAServiceProtocolPB.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.ha.HAServiceProtocol
HAServiceProtocol.HAServiceState, HAServiceProtocol.RequestSource, HAServiceProtocol.StateChangeRequestInfo -
Field Summary
Fields inherited from interface org.apache.hadoop.ha.HAServiceProtocol
versionID -
Constructor Summary
ConstructorsConstructorDescriptionHAServiceProtocolClientSideTranslatorPB(InetSocketAddress addr, Configuration conf, SocketFactory socketFactory, int timeout) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Return the current status of the service.Return the proxy object underlying this protocol translator.voidMonitor the health of service.voidRequest service to transition to active state.voidRequest service to transition to observer state.voidRequest service to transition to standby state.
-
Constructor Details
-
HAServiceProtocolClientSideTranslatorPB
public HAServiceProtocolClientSideTranslatorPB(InetSocketAddress addr, Configuration conf) throws IOException - Throws:
IOException
-
HAServiceProtocolClientSideTranslatorPB
public HAServiceProtocolClientSideTranslatorPB(InetSocketAddress addr, Configuration conf, SocketFactory socketFactory, int timeout) throws IOException - Throws:
IOException
-
-
Method Details
-
monitorHealth
Description copied from interface:HAServiceProtocolMonitor the health of service. This periodically called by the HA frameworks to monitor the health of the service. Service is expected to perform checks to ensure it is functional. If the service is not healthy due to failure or partial failure, it is expected to throwHealthCheckFailedException. The definition of service not healthy is left to the service. Note that when health check of an Active service fails, failover to standby may be done.- Specified by:
monitorHealthin interfaceHAServiceProtocol- Throws:
HealthCheckFailedException- if the health check of a service fails.AccessControlException- if access is denied.IOException- if other errors happen
-
transitionToActive
Description copied from interface:HAServiceProtocolRequest service to transition to active state. No operation, if the service is already in active state.- Specified by:
transitionToActivein interfaceHAServiceProtocol- Parameters:
reqInfo- reqInfo.- Throws:
ServiceFailedException- if transition from standby to active fails.AccessControlException- if access is denied.IOException- if other errors happen
-
transitionToStandby
public void transitionToStandby(HAServiceProtocol.StateChangeRequestInfo reqInfo) throws IOException Description copied from interface:HAServiceProtocolRequest service to transition to standby state. No operation, if the service is already in standby state.- Specified by:
transitionToStandbyin interfaceHAServiceProtocol- Parameters:
reqInfo- reqInfo.- Throws:
ServiceFailedException- if transition from active to standby fails.AccessControlException- if access is denied.IOException- if other errors happen
-
transitionToObserver
public void transitionToObserver(HAServiceProtocol.StateChangeRequestInfo reqInfo) throws IOException Description copied from interface:HAServiceProtocolRequest service to transition to observer state. No operation, if the service is already in observer state.- Specified by:
transitionToObserverin interfaceHAServiceProtocol- Parameters:
reqInfo- reqInfo.- Throws:
ServiceFailedException- if transition from standby to observer fails.AccessControlException- if access is denied.IOException- if other errors happen
-
getServiceStatus
Description copied from interface:HAServiceProtocolReturn the current status of the service. The status indicates the current state (e.g ACTIVE/STANDBY) as well as some additional information.- Specified by:
getServiceStatusin interfaceHAServiceProtocol- Returns:
- HAServiceStatus.
- Throws:
AccessControlException- if access is denied.IOException- if other errors happen- See Also:
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getUnderlyingProxyObject
Description copied from interface:ProtocolTranslatorReturn the proxy object underlying this protocol translator.- Specified by:
getUnderlyingProxyObjectin interfaceProtocolTranslator- Returns:
- the proxy object underlying this protocol translator.
-