YARN-625. Move the utility method unwrapAndThrowException from YarnRemoteExceptionPBImpl to RPCUtil. Contributed by Siddharth Seth.
svn merge --ignore-ancestry -c 1478594 ../../trunk/ git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1478595 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0411165008
commit
0b64df0630
|
@ -98,7 +98,7 @@ import org.apache.hadoop.security.proto.SecurityProtos.CancelDelegationTokenRequ
|
|||
import org.apache.hadoop.security.proto.SecurityProtos.GetDelegationTokenRequestProto;
|
||||
import org.apache.hadoop.security.proto.SecurityProtos.RenewDelegationTokenRequestProto;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
|
||||
import org.apache.hadoop.yarn.exceptions.impl.pb.YarnRemoteExceptionPBImpl;
|
||||
import org.apache.hadoop.yarn.ipc.RPCUtil;
|
||||
|
||||
import com.google.protobuf.ServiceException;
|
||||
|
||||
|
@ -133,7 +133,7 @@ public class MRClientProtocolPBClientImpl implements MRClientProtocol,
|
|||
try {
|
||||
return new GetJobReportResponsePBImpl(proxy.getJobReport(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ public class MRClientProtocolPBClientImpl implements MRClientProtocol,
|
|||
try {
|
||||
return new GetTaskReportResponsePBImpl(proxy.getTaskReport(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class MRClientProtocolPBClientImpl implements MRClientProtocol,
|
|||
try {
|
||||
return new GetTaskAttemptReportResponsePBImpl(proxy.getTaskAttemptReport(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ public class MRClientProtocolPBClientImpl implements MRClientProtocol,
|
|||
try {
|
||||
return new GetCountersResponsePBImpl(proxy.getCounters(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ public class MRClientProtocolPBClientImpl implements MRClientProtocol,
|
|||
try {
|
||||
return new GetTaskAttemptCompletionEventsResponsePBImpl(proxy.getTaskAttemptCompletionEvents(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ public class MRClientProtocolPBClientImpl implements MRClientProtocol,
|
|||
try {
|
||||
return new GetTaskReportsResponsePBImpl(proxy.getTaskReports(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ public class MRClientProtocolPBClientImpl implements MRClientProtocol,
|
|||
try {
|
||||
return new GetDiagnosticsResponsePBImpl(proxy.getDiagnostics(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ public class MRClientProtocolPBClientImpl implements MRClientProtocol,
|
|||
return new GetDelegationTokenResponsePBImpl(proxy.getDelegationToken(
|
||||
null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ public class MRClientProtocolPBClientImpl implements MRClientProtocol,
|
|||
try {
|
||||
return new KillJobResponsePBImpl(proxy.killJob(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@ public class MRClientProtocolPBClientImpl implements MRClientProtocol,
|
|||
try {
|
||||
return new KillTaskResponsePBImpl(proxy.killTask(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ public class MRClientProtocolPBClientImpl implements MRClientProtocol,
|
|||
try {
|
||||
return new KillTaskAttemptResponsePBImpl(proxy.killTaskAttempt(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ public class MRClientProtocolPBClientImpl implements MRClientProtocol,
|
|||
try {
|
||||
return new FailTaskAttemptResponsePBImpl(proxy.failTaskAttempt(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ public class MRClientProtocolPBClientImpl implements MRClientProtocol,
|
|||
return new RenewDelegationTokenResponsePBImpl(proxy.renewDelegationToken(
|
||||
null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,7 @@ public class MRClientProtocolPBClientImpl implements MRClientProtocol,
|
|||
proxy.cancelDelegationToken(null, requestProto));
|
||||
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,6 +129,9 @@ Release 2.0.5-beta - UNRELEASED
|
|||
YARN-618. Modified RM_INVALID_IDENTIFIER to be -1 instead of zero. (Jian He
|
||||
via vinodkv)
|
||||
|
||||
YARN-625. Move the utility method unwrapAndThrowException from
|
||||
YarnRemoteExceptionPBImpl to RPCUtil. (Siddharth Seth via vinodkv)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
|
|
@ -110,29 +110,4 @@ public class YarnRemoteExceptionPBImpl extends YarnRemoteException {
|
|||
viaProto = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method that unwraps and throws appropriate exception.
|
||||
* @param se ServiceException
|
||||
* @throws YarnRemoteException
|
||||
* @throws UndeclaredThrowableException
|
||||
*/
|
||||
public static YarnRemoteException unwrapAndThrowException(ServiceException se)
|
||||
throws UndeclaredThrowableException {
|
||||
if (se.getCause() instanceof RemoteException) {
|
||||
try {
|
||||
throw ((RemoteException) se.getCause())
|
||||
.unwrapRemoteException(YarnRemoteExceptionPBImpl.class);
|
||||
} catch (YarnRemoteException ex) {
|
||||
return ex;
|
||||
} catch (IOException e1) {
|
||||
throw new UndeclaredThrowableException(e1);
|
||||
}
|
||||
} else if (se.getCause() instanceof YarnRemoteException) {
|
||||
return (YarnRemoteException)se.getCause();
|
||||
} else if (se.getCause() instanceof UndeclaredThrowableException) {
|
||||
throw (UndeclaredThrowableException)se.getCause();
|
||||
} else {
|
||||
throw new UndeclaredThrowableException(se);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -40,7 +40,7 @@ import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.FinishApplicationMaste
|
|||
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.RegisterApplicationMasterRequestPBImpl;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.RegisterApplicationMasterResponsePBImpl;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
|
||||
import org.apache.hadoop.yarn.exceptions.impl.pb.YarnRemoteExceptionPBImpl;
|
||||
import org.apache.hadoop.yarn.ipc.RPCUtil;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.AllocateRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.FinishApplicationMasterRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.RegisterApplicationMasterRequestProto;
|
||||
|
@ -74,7 +74,7 @@ public class AMRMProtocolPBClientImpl implements AMRMProtocol, Closeable {
|
|||
try {
|
||||
return new AllocateResponsePBImpl(proxy.allocate(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class AMRMProtocolPBClientImpl implements AMRMProtocol, Closeable {
|
|||
return new FinishApplicationMasterResponsePBImpl(
|
||||
proxy.finishApplicationMaster(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public class AMRMProtocolPBClientImpl implements AMRMProtocol, Closeable {
|
|||
return new RegisterApplicationMasterResponsePBImpl(
|
||||
proxy.registerApplicationMaster(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.RenewDelegationTokenRe
|
|||
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.SubmitApplicationRequestPBImpl;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.SubmitApplicationResponsePBImpl;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
|
||||
import org.apache.hadoop.yarn.exceptions.impl.pb.YarnRemoteExceptionPBImpl;
|
||||
import org.apache.hadoop.yarn.ipc.RPCUtil;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetAllApplicationsRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationReportRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetClusterMetricsRequestProto;
|
||||
|
@ -120,7 +120,7 @@ public class ClientRMProtocolPBClientImpl implements ClientRMProtocol,
|
|||
return new KillApplicationResponsePBImpl(proxy.forceKillApplication(null,
|
||||
requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ public class ClientRMProtocolPBClientImpl implements ClientRMProtocol,
|
|||
return new GetApplicationReportResponsePBImpl(proxy.getApplicationReport(
|
||||
null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ public class ClientRMProtocolPBClientImpl implements ClientRMProtocol,
|
|||
return new GetClusterMetricsResponsePBImpl(proxy.getClusterMetrics(null,
|
||||
requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ public class ClientRMProtocolPBClientImpl implements ClientRMProtocol,
|
|||
return new GetNewApplicationResponsePBImpl(proxy.getNewApplication(null,
|
||||
requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ public class ClientRMProtocolPBClientImpl implements ClientRMProtocol,
|
|||
return new SubmitApplicationResponsePBImpl(proxy.submitApplication(null,
|
||||
requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ public class ClientRMProtocolPBClientImpl implements ClientRMProtocol,
|
|||
return new GetAllApplicationsResponsePBImpl(proxy.getAllApplications(
|
||||
null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ public class ClientRMProtocolPBClientImpl implements ClientRMProtocol,
|
|||
return new GetClusterNodesResponsePBImpl(proxy.getClusterNodes(null,
|
||||
requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ public class ClientRMProtocolPBClientImpl implements ClientRMProtocol,
|
|||
return new GetQueueInfoResponsePBImpl(proxy.getQueueInfo(null,
|
||||
requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ public class ClientRMProtocolPBClientImpl implements ClientRMProtocol,
|
|||
return new GetQueueUserAclsInfoResponsePBImpl(proxy.getQueueUserAcls(
|
||||
null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ public class ClientRMProtocolPBClientImpl implements ClientRMProtocol,
|
|||
return new GetDelegationTokenResponsePBImpl(proxy.getDelegationToken(
|
||||
null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,7 @@ public class ClientRMProtocolPBClientImpl implements ClientRMProtocol,
|
|||
return new RenewDelegationTokenResponsePBImpl(proxy.renewDelegationToken(
|
||||
null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ public class ClientRMProtocolPBClientImpl implements ClientRMProtocol,
|
|||
proxy.cancelDelegationToken(null, requestProto));
|
||||
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.StopContainerRequestPB
|
|||
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.StopContainerResponsePBImpl;
|
||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
|
||||
import org.apache.hadoop.yarn.exceptions.impl.pb.YarnRemoteExceptionPBImpl;
|
||||
import org.apache.hadoop.yarn.ipc.RPCUtil;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainerStatusRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.StartContainerRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.StopContainerRequestProto;
|
||||
|
@ -93,7 +93,7 @@ public class ContainerManagerPBClientImpl implements ContainerManager,
|
|||
return new GetContainerStatusResponsePBImpl(proxy.getContainerStatus(
|
||||
null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ public class ContainerManagerPBClientImpl implements ContainerManager,
|
|||
return new StartContainerResponsePBImpl(proxy.startContainer(null,
|
||||
requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class ContainerManagerPBClientImpl implements ContainerManager,
|
|||
return new StopContainerResponsePBImpl(proxy.stopContainer(null,
|
||||
requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.RefreshSuperUserGroups
|
|||
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.RefreshUserToGroupsMappingsRequestPBImpl;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.RefreshUserToGroupsMappingsResponsePBImpl;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
|
||||
import org.apache.hadoop.yarn.exceptions.impl.pb.YarnRemoteExceptionPBImpl;
|
||||
import org.apache.hadoop.yarn.ipc.RPCUtil;
|
||||
import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.GetGroupsForUserRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.GetGroupsForUserResponseProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.RefreshAdminAclsRequestProto;
|
||||
|
@ -94,7 +94,7 @@ public class RMAdminProtocolPBClientImpl implements RMAdminProtocol, Closeable {
|
|||
return new RefreshQueuesResponsePBImpl(
|
||||
proxy.refreshQueues(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class RMAdminProtocolPBClientImpl implements RMAdminProtocol, Closeable {
|
|||
return new RefreshNodesResponsePBImpl(
|
||||
proxy.refreshNodes(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ public class RMAdminProtocolPBClientImpl implements RMAdminProtocol, Closeable {
|
|||
return new RefreshSuperUserGroupsConfigurationResponsePBImpl(
|
||||
proxy.refreshSuperUserGroupsConfiguration(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ public class RMAdminProtocolPBClientImpl implements RMAdminProtocol, Closeable {
|
|||
return new RefreshUserToGroupsMappingsResponsePBImpl(
|
||||
proxy.refreshUserToGroupsMappings(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ public class RMAdminProtocolPBClientImpl implements RMAdminProtocol, Closeable {
|
|||
return new RefreshAdminAclsResponsePBImpl(
|
||||
proxy.refreshAdminAcls(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ public class RMAdminProtocolPBClientImpl implements RMAdminProtocol, Closeable {
|
|||
return new RefreshServiceAclsResponsePBImpl(proxy.refreshServiceAcls(
|
||||
null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,11 +18,18 @@
|
|||
|
||||
package org.apache.hadoop.yarn.ipc;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.UndeclaredThrowableException;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.ipc.RemoteException;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
|
||||
import org.apache.hadoop.yarn.exceptions.impl.pb.YarnRemoteExceptionPBImpl;
|
||||
import org.apache.hadoop.yarn.factories.YarnRemoteExceptionFactory;
|
||||
import org.apache.hadoop.yarn.factory.providers.YarnRemoteExceptionFactoryProvider;
|
||||
|
||||
import com.google.protobuf.ServiceException;
|
||||
|
||||
public class RPCUtil {
|
||||
|
||||
|
||||
|
@ -52,4 +59,31 @@ public class RPCUtil {
|
|||
(e.getRemoteTrace() == null ? "" : "\n StackTrace: " + e.getRemoteTrace()) +
|
||||
(e.getCause() == null ? "" : "\n Caused by: " + toString(e.getCause()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method that unwraps and throws appropriate exception.
|
||||
*
|
||||
* @param se ServiceException
|
||||
* @throws YarnRemoteException
|
||||
* @throws UndeclaredThrowableException
|
||||
*/
|
||||
public static YarnRemoteException unwrapAndThrowException(ServiceException se)
|
||||
throws UndeclaredThrowableException {
|
||||
if (se.getCause() instanceof RemoteException) {
|
||||
try {
|
||||
throw ((RemoteException) se.getCause())
|
||||
.unwrapRemoteException(YarnRemoteExceptionPBImpl.class);
|
||||
} catch (YarnRemoteException ex) {
|
||||
return ex;
|
||||
} catch (IOException e1) {
|
||||
throw new UndeclaredThrowableException(e1);
|
||||
}
|
||||
} else if (se.getCause() instanceof YarnRemoteException) {
|
||||
return (YarnRemoteException) se.getCause();
|
||||
} else if (se.getCause() instanceof UndeclaredThrowableException) {
|
||||
throw (UndeclaredThrowableException) se.getCause();
|
||||
} else {
|
||||
throw new UndeclaredThrowableException(se);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.hadoop.conf.Configuration;
|
|||
import org.apache.hadoop.ipc.ProtobufRpcEngine;
|
||||
import org.apache.hadoop.ipc.RPC;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
|
||||
import org.apache.hadoop.yarn.exceptions.impl.pb.YarnRemoteExceptionPBImpl;
|
||||
import org.apache.hadoop.yarn.ipc.RPCUtil;
|
||||
import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.NodeHeartbeatRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.RegisterNodeManagerRequestProto;
|
||||
import org.apache.hadoop.yarn.server.api.ResourceTracker;
|
||||
|
@ -58,7 +58,7 @@ private ResourceTrackerPB proxy;
|
|||
try {
|
||||
return new RegisterNodeManagerResponsePBImpl(proxy.registerNodeManager(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ private ResourceTrackerPB proxy;
|
|||
try {
|
||||
return new NodeHeartbeatResponsePBImpl(proxy.nodeHeartbeat(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.hadoop.conf.Configuration;
|
|||
import org.apache.hadoop.ipc.ProtobufRpcEngine;
|
||||
import org.apache.hadoop.ipc.RPC;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
|
||||
import org.apache.hadoop.yarn.exceptions.impl.pb.YarnRemoteExceptionPBImpl;
|
||||
import org.apache.hadoop.yarn.ipc.RPCUtil;
|
||||
import org.apache.hadoop.yarn.proto.YarnServerNodemanagerServiceProtos.LocalizerStatusProto;
|
||||
import org.apache.hadoop.yarn.server.nodemanager.api.LocalizationProtocol;
|
||||
import org.apache.hadoop.yarn.server.nodemanager.api.LocalizationProtocolPB;
|
||||
|
@ -62,7 +62,7 @@ public class LocalizationProtocolPBClientImpl implements LocalizationProtocol,
|
|||
return new LocalizerHeartbeatResponsePBImpl(
|
||||
proxy.heartbeat(null, statusProto));
|
||||
} catch (ServiceException e) {
|
||||
throw YarnRemoteExceptionPBImpl.unwrapAndThrowException(e);
|
||||
throw RPCUtil.unwrapAndThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue