YARN-532. Change RMAdmin and Localization client protocol PB implementations to implement closeable so that they can be stopped when needed via RPC.stopProxy(). Contributed by Siddharth Seth.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1464788 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2013-04-04 23:30:15 +00:00
parent 999ce497f0
commit 0836d68abf
3 changed files with 24 additions and 3 deletions

View File

@ -191,6 +191,10 @@ Release 2.0.5-beta - UNRELEASED
YARN-538. RM address DNS lookup can cause unnecessary slowness on every JHS
page load. (sandyr via tucu)
YARN-532. Change RMAdmin and Localization client protocol PB implementations
to implement closeable so that they can be stopped when needed via
RPC.stopProxy(). (Siddharth Seth via vinodkv)
Release 2.0.4-alpha - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -18,6 +18,7 @@
package org.apache.hadoop.yarn.api.impl.pb.client;
import java.io.Closeable;
import java.io.IOException;
import java.net.InetSocketAddress;
@ -65,7 +66,7 @@ import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.Refre
import com.google.protobuf.ServiceException;
public class RMAdminProtocolPBClientImpl implements RMAdminProtocol {
public class RMAdminProtocolPBClientImpl implements RMAdminProtocol, Closeable {
private RMAdminProtocolPB proxy;
@ -77,6 +78,13 @@ public class RMAdminProtocolPBClientImpl implements RMAdminProtocol {
RMAdminProtocolPB.class, clientVersion, addr, conf);
}
@Override
public void close() {
if (this.proxy != null) {
RPC.stopProxy(this.proxy);
}
}
@Override
public RefreshQueuesResponse refreshQueues(RefreshQueuesRequest request)
throws YarnRemoteException {

View File

@ -17,6 +17,7 @@
*/
package org.apache.hadoop.yarn.server.nodemanager.api.impl.pb.client;
import java.io.Closeable;
import java.io.IOException;
import java.net.InetSocketAddress;
@ -35,7 +36,8 @@ import org.apache.hadoop.yarn.server.nodemanager.api.protocolrecords.impl.pb.Loc
import com.google.protobuf.ServiceException;
public class LocalizationProtocolPBClientImpl implements LocalizationProtocol {
public class LocalizationProtocolPBClientImpl implements LocalizationProtocol,
Closeable {
private LocalizationProtocolPB proxy;
@ -44,7 +46,14 @@ public class LocalizationProtocolPBClientImpl implements LocalizationProtocol {
proxy = (LocalizationProtocolPB)RPC.getProxy(
LocalizationProtocolPB.class, clientVersion, addr, conf);
}
@Override
public void close() {
if (this.proxy != null) {
RPC.stopProxy(this.proxy);
}
}
@Override
public LocalizerHeartbeatResponse heartbeat(LocalizerStatus status)
throws YarnRemoteException {