From 53b3dd18a58ac2e8489c3df19bc9f3bc08e63b32 Mon Sep 17 00:00:00 2001 From: Vinod Kumar Vavilapalli Date: Thu, 4 Apr 2013 23:31:12 +0000 Subject: [PATCH] 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. svn merge --ignore-ancestry -c 1464788 ../../trunk/ git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1464789 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-yarn-project/CHANGES.txt | 4 ++++ .../impl/pb/client/RMAdminProtocolPBClientImpl.java | 10 +++++++++- .../pb/client/LocalizationProtocolPBClientImpl.java | 13 +++++++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 1df51bf2a59..3c18c27aaf4 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -136,6 +136,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 diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/RMAdminProtocolPBClientImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/RMAdminProtocolPBClientImpl.java index 051df592570..f7b39f218b3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/RMAdminProtocolPBClientImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/RMAdminProtocolPBClientImpl.java @@ -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 { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/impl/pb/client/LocalizationProtocolPBClientImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/impl/pb/client/LocalizationProtocolPBClientImpl.java index 80b3f79869a..257417d0db0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/impl/pb/client/LocalizationProtocolPBClientImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/impl/pb/client/LocalizationProtocolPBClientImpl.java @@ -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 {