use of org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolPB in project ozone by apache.
the class SCMConnectionManager method addSCMServer.
/**
* adds a new SCM machine to the target set.
*
* @param address - Address of the SCM machine to send heartbeat to.
* @throws IOException
*/
public void addSCMServer(InetSocketAddress address) throws IOException {
writeLock();
try {
if (scmMachines.containsKey(address)) {
LOG.warn("Trying to add an existing SCM Machine to Machines group. " + "Ignoring the request.");
return;
}
Configuration hadoopConfig = LegacyHadoopConfigurationSource.asHadoopConfiguration(this.conf);
RPC.setProtocolEngine(hadoopConfig, StorageContainerDatanodeProtocolPB.class, ProtobufRpcEngine.class);
long version = RPC.getProtocolVersion(StorageContainerDatanodeProtocolPB.class);
RetryPolicy retryPolicy = RetryPolicies.retryUpToMaximumCountWithFixedSleep(getScmRpcRetryCount(conf), getScmRpcRetryInterval(conf), TimeUnit.MILLISECONDS);
StorageContainerDatanodeProtocolPB rpcProxy = RPC.getProtocolProxy(StorageContainerDatanodeProtocolPB.class, version, address, UserGroupInformation.getCurrentUser(), hadoopConfig, NetUtils.getDefaultSocketFactory(hadoopConfig), getRpcTimeout(), retryPolicy).getProxy();
StorageContainerDatanodeProtocolClientSideTranslatorPB rpcClient = new StorageContainerDatanodeProtocolClientSideTranslatorPB(rpcProxy);
EndpointStateMachine endPoint = new EndpointStateMachine(address, rpcClient, this.conf);
endPoint.setPassive(false);
scmMachines.put(address, endPoint);
} finally {
writeUnlock();
}
}
use of org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolPB in project ozone by apache.
the class ContainerTestUtils method createEndpoint.
/**
* Creates an Endpoint class for testing purpose.
*
* @param conf - Conf
* @param address - InetAddres
* @param rpcTimeout - rpcTimeOut
* @return EndPoint
* @throws Exception
*/
public static EndpointStateMachine createEndpoint(Configuration conf, InetSocketAddress address, int rpcTimeout) throws Exception {
RPC.setProtocolEngine(conf, StorageContainerDatanodeProtocolPB.class, ProtobufRpcEngine.class);
long version = RPC.getProtocolVersion(StorageContainerDatanodeProtocolPB.class);
StorageContainerDatanodeProtocolPB rpcProxy = RPC.getProtocolProxy(StorageContainerDatanodeProtocolPB.class, version, address, UserGroupInformation.getCurrentUser(), conf, NetUtils.getDefaultSocketFactory(conf), rpcTimeout, RetryPolicies.TRY_ONCE_THEN_FAIL).getProxy();
StorageContainerDatanodeProtocolClientSideTranslatorPB rpcClient = new StorageContainerDatanodeProtocolClientSideTranslatorPB(rpcProxy);
return new EndpointStateMachine(address, rpcClient, new LegacyHadoopConfigurationSource(conf));
}
use of org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolPB in project ozone by apache.
the class SCMThroughputBenchmark method createDatanodeScmClient.
private StorageContainerDatanodeProtocol createDatanodeScmClient() throws IOException {
int dnPort = conf.getInt(OZONE_SCM_DATANODE_PORT_KEY, OZONE_SCM_DATANODE_PORT_DEFAULT);
InetSocketAddress scmAddress = NetUtils.createSocketAddr(scm, dnPort);
Configuration hadoopConfig = LegacyHadoopConfigurationSource.asHadoopConfiguration(this.conf);
RPC.setProtocolEngine(hadoopConfig, StorageContainerDatanodeProtocolPB.class, ProtobufRpcEngine.class);
long version = RPC.getProtocolVersion(StorageContainerDatanodeProtocolPB.class);
SCMClientConfig scmClientConfig = conf.getObject(SCMClientConfig.class);
int rpcTimeout = (int) scmClientConfig.getRpcTimeOut();
RetryPolicy retryPolicy = RetryPolicies.retryUpToMaximumCountWithFixedSleep(getScmRpcRetryCount(conf), getScmRpcRetryInterval(conf), TimeUnit.MILLISECONDS);
StorageContainerDatanodeProtocolPB rpcProxy = RPC.getProtocolProxy(StorageContainerDatanodeProtocolPB.class, version, scmAddress, UserGroupInformation.getCurrentUser(), hadoopConfig, NetUtils.getDefaultSocketFactory(hadoopConfig), rpcTimeout, retryPolicy).getProxy();
return new StorageContainerDatanodeProtocolClientSideTranslatorPB(rpcProxy);
}
Aggregations