Example usage for org.apache.hadoop.ipc RPC stopProxy

List of usage examples for org.apache.hadoop.ipc RPC stopProxy

Introduction

In this page you can find the example usage for org.apache.hadoop.ipc RPC stopProxy.

Prototype

public static void stopProxy(Object proxy) 

Source Link

Document

Stop the proxy.

Usage

From source file:azkaban.security.HadoopSecurityManager_H_2_0.java

License:Apache License

private void cancelJhsToken(final Token<? extends TokenIdentifier> t, String userToProxy)
        throws HadoopSecurityManagerException {
    // it appears yarn would clean up this token after app finish, after a long
    // while though.
    org.apache.hadoop.yarn.api.records.Token token = org.apache.hadoop.yarn.api.records.Token
            .newInstance(t.getIdentifier(), t.getKind().toString(), t.getPassword(), t.getService().toString());
    final YarnRPC rpc = YarnRPC.create(conf);
    final InetSocketAddress jhsAddress = SecurityUtil.getTokenServiceAddr(t);
    MRClientProtocol jhsProxy = null;/*  w w w.jav a  2 s  .  c  o  m*/
    try {
        jhsProxy = UserGroupInformation.getCurrentUser().doAs(new PrivilegedAction<MRClientProtocol>() {
            @Override
            public MRClientProtocol run() {
                return (MRClientProtocol) rpc.getProxy(HSClientProtocol.class, jhsAddress, conf);
            }
        });
        CancelDelegationTokenRequest request = Records.newRecord(CancelDelegationTokenRequest.class);
        request.setDelegationToken(token);
        jhsProxy.cancelDelegationToken(request);
    } catch (Exception e) {
        throw new HadoopSecurityManagerException("Failed to cancel token. " + e.getMessage() + e.getCause(), e);
    } finally {
        RPC.stopProxy(jhsProxy);
    }

}

From source file:cn.dayutianfei.hadoop.rpc.client.RPCProxyManager.java

License:Apache License

private void dropNodeProxy(String nodeName, int failureCount) {
    synchronized (nodeName.intern()) {
        if (node2ProxyMap.containsKey(nodeName)) {
            LOG.warn("removing proxy for node '" + nodeName + "' after " + failureCount
                    + " proxy-invocation errors");
            _failedNodeInteractions.remove(nodeName, Integer.MAX_VALUE);
            VersionedProtocol proxy = node2ProxyMap.remove(nodeName);
            RPC.stopProxy(proxy);
        }/*from  w w  w. j  a v a 2 s.  c o  m*/
    }
}

From source file:cn.dayutianfei.hadoop.rpc.client.RPCProxyManager.java

License:Apache License

public void shutdown() {
    Collection<VersionedProtocol> proxies = node2ProxyMap.values();
    for (VersionedProtocol search : proxies) {
        RPC.stopProxy(search);
    }
}

From source file:com.chinamobile.bcbsp.client.BSPJobClient.java

License:Apache License

/**
 * Close the <code>JobClient</code>.
 *//*from  w  w w  .  ja  va2 s .c  o m*/
public synchronized void close() throws IOException {
    RPC.stopProxy(jobSubmitClient);
}

From source file:com.chinamobile.bcbsp.workermanager.WorkerManager.java

License:Apache License

/**
 * Stop all Staff Process and WorkerAgentForJob.
 * Stop all RPC Server./*from w  ww  .j  a  v  a2s  .c om*/
 * Clean up temporary files on the local disk.
 */
@Override
@SuppressWarnings("deprecation")
public synchronized void close() {
    this.running = false;
    this.initialized = false;
    try {
        for (StaffInProgress sip : runningStaffs.values()) {
            if (sip.runner.isAlive()) {
                sip.killAndCleanup(true);
                LOG.info(sip.getStatus().getStaffId() + " has been killed by system");
            }
        }
        LOG.info("Succeed to stop all Staff Process");
        for (Map.Entry<BSPJobID, WorkerAgentForJob> e : runningJobtoWorkerAgent.entrySet()) {
            e.getValue().close();
        }
        LOG.info("Succeed to stop all WorkerAgentForJob");
        this.workerServer.stop();
        this.lsManager.stop();
        RPC.stopProxy(controllerClient);
        if (staffReportServer != null) {
            staffReportServer.stop();
            staffReportServer = null;
        }
        LOG.info("Succeed to stop all RPC Server");
        cleanupStorage();
        LOG.info("Succeed to cleanup temporary files on the local disk");
    } catch (Exception e) {
        //LOG.error("Failed to execute the close()", e);
        throw new RuntimeException("WorkerManager run" + " Failed to execute the close()", e);
    }
}

From source file:com.continuuity.weave.internal.yarn.ports.AMRMClientImpl.java

License:Apache License

@Override
public synchronized void stop() {
    if (this.rmClient != null) {
        RPC.stopProxy(this.rmClient);
    }//from   w  w w  .j av  a2s  .c  o m
    super.stop();
}

From source file:com.dasasian.chok.client.NodeProxyManager.java

License:Apache License

private void dropNodeProxy(String nodeName, int failureCount) {
    synchronized (nodeName.intern()) {
        if (node2ProxyMap.containsKey(nodeName)) {
            LOG.warn("removing proxy for node '" + nodeName + "' after " + failureCount
                    + " proxy-invocation errors");
            failedNodeInteractions.remove(nodeName, Integer.MAX_VALUE);
            selectionPolicy.removeNode(nodeName);
            VersionedProtocol proxy = node2ProxyMap.remove(nodeName);
            RPC.stopProxy(proxy);
        }//from  w  w w.ja  va 2  s  . c  om
    }
}

From source file:com.dasasian.chok.client.NodeProxyManager.java

License:Apache License

@Override
public void shutdown() {
    Collection<VersionedProtocol> proxies = node2ProxyMap.values();
    for (VersionedProtocol search : proxies) {
        RPC.stopProxy(search);
    }//from  w w  w .j  av a2s . c  o m
}

From source file:com.datatorrent.stram.RecoverableRpcProxy.java

License:Apache License

@Override
public void close() {
    LOG.debug("Closing RPC connection {}", lastConnectURI);
    if (umbilical != null) {
        RPC.stopProxy(umbilical);
        umbilical = null;/*from   w  ww.j a v a2s. co m*/
    }
}

From source file:com.github.hdl.tensorflow.yarn.app.api.impl.pb.client.TensorFlowClusterPBClientImpl.java

License:Apache License

@Override
public void close() {
    if (this.proxy != null) {
        RPC.stopProxy(this.proxy);
    }
}