HDFS-4393. Merge 1434844 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1434852 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7b5b90599f
commit
8b080841dd
|
@ -202,6 +202,9 @@ Release 2.0.3-alpha - Unreleased
|
|||
HDFS-4392. Use NetUtils#getFreeSocketPort in MiniDFSCluster.
|
||||
(Andrew Purtell via suresh)
|
||||
|
||||
HDFS-4393. Make empty request and responses in protocol translators can be
|
||||
static final members. (Brandon Li via suresh)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
HDFS-3429. DataNode reads checksums even if client does not need them (todd)
|
||||
|
|
|
@ -77,7 +77,7 @@ public class ClientDatanodeProtocolTranslatorPB implements
|
|||
/** RpcController is not used and hence is set to null */
|
||||
private final static RpcController NULL_CONTROLLER = null;
|
||||
private final ClientDatanodeProtocolPB rpcProxy;
|
||||
private final static RefreshNamenodesRequestProto REFRESH_NAMENODES =
|
||||
private final static RefreshNamenodesRequestProto VOID_REFRESH_NAMENODES =
|
||||
RefreshNamenodesRequestProto.newBuilder().build();
|
||||
|
||||
public ClientDatanodeProtocolTranslatorPB(DatanodeID datanodeid,
|
||||
|
@ -170,7 +170,7 @@ public class ClientDatanodeProtocolTranslatorPB implements
|
|||
@Override
|
||||
public void refreshNamenodes() throws IOException {
|
||||
try {
|
||||
rpcProxy.refreshNamenodes(NULL_CONTROLLER, REFRESH_NAMENODES);
|
||||
rpcProxy.refreshNamenodes(NULL_CONTROLLER, VOID_REFRESH_NAMENODES);
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
|
|
@ -148,6 +148,78 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
ClientNamenodeProtocolPB {
|
||||
final private ClientProtocol server;
|
||||
|
||||
private static final CreateResponseProto VOID_CREATE_RESPONSE =
|
||||
CreateResponseProto.newBuilder().build();
|
||||
|
||||
private static final AppendResponseProto VOID_APPEND_RESPONSE =
|
||||
AppendResponseProto.newBuilder().build();
|
||||
|
||||
private static final SetPermissionResponseProto VOID_SET_PERM_RESPONSE =
|
||||
SetPermissionResponseProto.newBuilder().build();
|
||||
|
||||
private static final SetOwnerResponseProto VOID_SET_OWNER_RESPONSE =
|
||||
SetOwnerResponseProto.newBuilder().build();
|
||||
|
||||
private static final AbandonBlockResponseProto VOID_ADD_BLOCK_RESPONSE =
|
||||
AbandonBlockResponseProto.newBuilder().build();
|
||||
|
||||
private static final ReportBadBlocksResponseProto VOID_REP_BAD_BLOCK_RESPONSE =
|
||||
ReportBadBlocksResponseProto.newBuilder().build();
|
||||
|
||||
private static final ConcatResponseProto VOID_CONCAT_RESPONSE =
|
||||
ConcatResponseProto.newBuilder().build();
|
||||
|
||||
private static final Rename2ResponseProto VOID_RENAME2_RESPONSE =
|
||||
Rename2ResponseProto.newBuilder().build();
|
||||
|
||||
private static final GetListingResponseProto VOID_GETLISTING_RESPONSE =
|
||||
GetListingResponseProto.newBuilder().build();
|
||||
|
||||
private static final RenewLeaseResponseProto VOID_RENEWLEASE_RESPONSE =
|
||||
RenewLeaseResponseProto.newBuilder().build();
|
||||
|
||||
private static final SaveNamespaceResponseProto VOID_SAVENAMESPACE_RESPONSE =
|
||||
SaveNamespaceResponseProto.newBuilder().build();
|
||||
|
||||
private static final RefreshNodesResponseProto VOID_REFRESHNODES_RESPONSE =
|
||||
RefreshNodesResponseProto.newBuilder().build();
|
||||
|
||||
private static final FinalizeUpgradeResponseProto VOID_FINALIZEUPGRADE_RESPONSE =
|
||||
FinalizeUpgradeResponseProto.newBuilder().build();
|
||||
|
||||
private static final MetaSaveResponseProto VOID_METASAVE_RESPONSE =
|
||||
MetaSaveResponseProto.newBuilder().build();
|
||||
|
||||
private static final GetFileInfoResponseProto VOID_GETFILEINFO_RESPONSE =
|
||||
GetFileInfoResponseProto.newBuilder().build();
|
||||
|
||||
private static final GetFileLinkInfoResponseProto VOID_GETFILELINKINFO_RESPONSE =
|
||||
GetFileLinkInfoResponseProto.newBuilder().build();
|
||||
|
||||
private static final SetQuotaResponseProto VOID_SETQUOTA_RESPONSE =
|
||||
SetQuotaResponseProto.newBuilder().build();
|
||||
|
||||
private static final FsyncResponseProto VOID_FSYNC_RESPONSE =
|
||||
FsyncResponseProto.newBuilder().build();
|
||||
|
||||
private static final SetTimesResponseProto VOID_SETTIMES_RESPONSE =
|
||||
SetTimesResponseProto.newBuilder().build();
|
||||
|
||||
private static final CreateSymlinkResponseProto VOID_CREATESYMLINK_RESPONSE =
|
||||
CreateSymlinkResponseProto.newBuilder().build();
|
||||
|
||||
private static final UpdatePipelineResponseProto
|
||||
VOID_UPDATEPIPELINE_RESPONSE =
|
||||
UpdatePipelineResponseProto.newBuilder().build();
|
||||
|
||||
private static final CancelDelegationTokenResponseProto
|
||||
VOID_CANCELDELEGATIONTOKEN_RESPONSE =
|
||||
CancelDelegationTokenResponseProto.newBuilder().build();
|
||||
|
||||
private static final SetBalancerBandwidthResponseProto
|
||||
VOID_SETBALANCERBANDWIDTH_RESPONSE =
|
||||
SetBalancerBandwidthResponseProto.newBuilder().build();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
@ -192,9 +264,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
}
|
||||
|
||||
|
||||
static final CreateResponseProto VOID_CREATE_RESPONSE =
|
||||
CreateResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public CreateResponseProto create(RpcController controller,
|
||||
CreateRequestProto req) throws ServiceException {
|
||||
|
@ -209,9 +278,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
return VOID_CREATE_RESPONSE;
|
||||
}
|
||||
|
||||
static final AppendResponseProto NULL_APPEND_RESPONSE =
|
||||
AppendResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public AppendResponseProto append(RpcController controller,
|
||||
AppendRequestProto req) throws ServiceException {
|
||||
|
@ -221,7 +287,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
return AppendResponseProto.newBuilder()
|
||||
.setBlock(PBHelper.convert(result)).build();
|
||||
}
|
||||
return NULL_APPEND_RESPONSE;
|
||||
return VOID_APPEND_RESPONSE;
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
|
@ -240,9 +306,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
}
|
||||
|
||||
|
||||
static final SetPermissionResponseProto VOID_SET_PERM_RESPONSE =
|
||||
SetPermissionResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public SetPermissionResponseProto setPermission(RpcController controller,
|
||||
SetPermissionRequestProto req) throws ServiceException {
|
||||
|
@ -254,9 +317,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
return VOID_SET_PERM_RESPONSE;
|
||||
}
|
||||
|
||||
static final SetOwnerResponseProto VOID_SET_OWNER_RESPONSE =
|
||||
SetOwnerResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public SetOwnerResponseProto setOwner(RpcController controller,
|
||||
SetOwnerRequestProto req) throws ServiceException {
|
||||
|
@ -270,9 +330,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
return VOID_SET_OWNER_RESPONSE;
|
||||
}
|
||||
|
||||
static final AbandonBlockResponseProto VOID_ADD_BLOCK_RESPONSE =
|
||||
AbandonBlockResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public AbandonBlockResponseProto abandonBlock(RpcController controller,
|
||||
AbandonBlockRequestProto req) throws ServiceException {
|
||||
|
@ -338,9 +395,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
}
|
||||
}
|
||||
|
||||
static final ReportBadBlocksResponseProto VOID_REP_BAD_BLOCK_RESPONSE =
|
||||
ReportBadBlocksResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public ReportBadBlocksResponseProto reportBadBlocks(RpcController controller,
|
||||
ReportBadBlocksRequestProto req) throws ServiceException {
|
||||
|
@ -354,9 +408,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
return VOID_REP_BAD_BLOCK_RESPONSE;
|
||||
}
|
||||
|
||||
static final ConcatResponseProto VOID_CONCAT_RESPONSE =
|
||||
ConcatResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public ConcatResponseProto concat(RpcController controller,
|
||||
ConcatRequestProto req) throws ServiceException {
|
||||
|
@ -380,9 +431,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
}
|
||||
}
|
||||
|
||||
static final Rename2ResponseProto VOID_RENAME2_RESPONSE =
|
||||
Rename2ResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public Rename2ResponseProto rename2(RpcController controller,
|
||||
Rename2RequestProto req) throws ServiceException {
|
||||
|
@ -419,8 +467,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
}
|
||||
}
|
||||
|
||||
static final GetListingResponseProto NULL_GETLISTING_RESPONSE =
|
||||
GetListingResponseProto.newBuilder().build();
|
||||
@Override
|
||||
public GetListingResponseProto getListing(RpcController controller,
|
||||
GetListingRequestProto req) throws ServiceException {
|
||||
|
@ -432,16 +478,13 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
return GetListingResponseProto.newBuilder().setDirList(
|
||||
PBHelper.convert(result)).build();
|
||||
} else {
|
||||
return NULL_GETLISTING_RESPONSE;
|
||||
return VOID_GETLISTING_RESPONSE;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
}
|
||||
|
||||
static final RenewLeaseResponseProto VOID_RENEWLEASE_RESPONSE =
|
||||
RenewLeaseResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public RenewLeaseResponseProto renewLease(RpcController controller,
|
||||
RenewLeaseRequestProto req) throws ServiceException {
|
||||
|
@ -526,9 +569,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
}
|
||||
}
|
||||
|
||||
static final SaveNamespaceResponseProto VOID_SAVENAMESPACE_RESPONSE =
|
||||
SaveNamespaceResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public SaveNamespaceResponseProto saveNamespace(RpcController controller,
|
||||
SaveNamespaceRequestProto req) throws ServiceException {
|
||||
|
@ -555,9 +595,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
}
|
||||
|
||||
|
||||
static final RefreshNodesResponseProto VOID_REFRESHNODES_RESPONSE =
|
||||
RefreshNodesResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public RefreshNodesResponseProto refreshNodes(RpcController controller,
|
||||
RefreshNodesRequestProto req) throws ServiceException {
|
||||
|
@ -570,9 +607,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
|
||||
}
|
||||
|
||||
static final FinalizeUpgradeResponseProto VOID_FINALIZEUPGRADE_RESPONSE =
|
||||
FinalizeUpgradeResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public FinalizeUpgradeResponseProto finalizeUpgrade(RpcController controller,
|
||||
FinalizeUpgradeRequestProto req) throws ServiceException {
|
||||
|
@ -599,9 +633,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
}
|
||||
}
|
||||
|
||||
static final MetaSaveResponseProto VOID_METASAVE_RESPONSE =
|
||||
MetaSaveResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public MetaSaveResponseProto metaSave(RpcController controller,
|
||||
MetaSaveRequestProto req) throws ServiceException {
|
||||
|
@ -614,8 +645,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
|
||||
}
|
||||
|
||||
static final GetFileInfoResponseProto NULL_GETFILEINFO_RESPONSE =
|
||||
GetFileInfoResponseProto.newBuilder().build();
|
||||
@Override
|
||||
public GetFileInfoResponseProto getFileInfo(RpcController controller,
|
||||
GetFileInfoRequestProto req) throws ServiceException {
|
||||
|
@ -626,14 +655,12 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
return GetFileInfoResponseProto.newBuilder().setFs(
|
||||
PBHelper.convert(result)).build();
|
||||
}
|
||||
return NULL_GETFILEINFO_RESPONSE;
|
||||
return VOID_GETFILEINFO_RESPONSE;
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
}
|
||||
|
||||
static final GetFileLinkInfoResponseProto NULL_GETFILELINKINFO_RESPONSE =
|
||||
GetFileLinkInfoResponseProto.newBuilder().build();
|
||||
@Override
|
||||
public GetFileLinkInfoResponseProto getFileLinkInfo(RpcController controller,
|
||||
GetFileLinkInfoRequestProto req) throws ServiceException {
|
||||
|
@ -645,7 +672,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
PBHelper.convert(result)).build();
|
||||
} else {
|
||||
System.out.println("got null result for getFileLinkInfo for " + req.getSrc());
|
||||
return NULL_GETFILELINKINFO_RESPONSE;
|
||||
return VOID_GETFILELINKINFO_RESPONSE;
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
|
@ -666,9 +693,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
}
|
||||
}
|
||||
|
||||
static final SetQuotaResponseProto VOID_SETQUOTA_RESPONSE =
|
||||
SetQuotaResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public SetQuotaResponseProto setQuota(RpcController controller,
|
||||
SetQuotaRequestProto req) throws ServiceException {
|
||||
|
@ -681,9 +705,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
}
|
||||
}
|
||||
|
||||
static final FsyncResponseProto VOID_FSYNC_RESPONSE =
|
||||
FsyncResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public FsyncResponseProto fsync(RpcController controller,
|
||||
FsyncRequestProto req) throws ServiceException {
|
||||
|
@ -695,9 +716,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
}
|
||||
}
|
||||
|
||||
static final SetTimesResponseProto VOID_SETTIMES_RESPONSE =
|
||||
SetTimesResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public SetTimesResponseProto setTimes(RpcController controller,
|
||||
SetTimesRequestProto req) throws ServiceException {
|
||||
|
@ -709,9 +727,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
}
|
||||
}
|
||||
|
||||
static final CreateSymlinkResponseProto VOID_CREATESYMLINK_RESPONSE =
|
||||
CreateSymlinkResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public CreateSymlinkResponseProto createSymlink(RpcController controller,
|
||||
CreateSymlinkRequestProto req) throws ServiceException {
|
||||
|
@ -755,9 +770,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
}
|
||||
}
|
||||
|
||||
static final UpdatePipelineResponseProto VOID_UPDATEPIPELINE_RESPONSE =
|
||||
UpdatePipelineResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public UpdatePipelineResponseProto updatePipeline(RpcController controller,
|
||||
UpdatePipelineRequestProto req) throws ServiceException {
|
||||
|
@ -805,10 +817,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
}
|
||||
}
|
||||
|
||||
static final CancelDelegationTokenResponseProto
|
||||
VOID_CANCELDELEGATIONTOKEN_RESPONSE =
|
||||
CancelDelegationTokenResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public CancelDelegationTokenResponseProto cancelDelegationToken(
|
||||
RpcController controller, CancelDelegationTokenRequestProto req)
|
||||
|
@ -822,10 +830,6 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
}
|
||||
}
|
||||
|
||||
static final SetBalancerBandwidthResponseProto
|
||||
VOID_SETBALANCERBANDWIDTH_RESPONSE =
|
||||
SetBalancerBandwidthResponseProto.newBuilder().build();
|
||||
|
||||
@Override
|
||||
public SetBalancerBandwidthResponseProto setBalancerBandwidth(
|
||||
RpcController controller, SetBalancerBandwidthRequestProto req)
|
||||
|
|
|
@ -129,6 +129,29 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
ProtocolMetaInterface, ClientProtocol, Closeable, ProtocolTranslator {
|
||||
final private ClientNamenodeProtocolPB rpcProxy;
|
||||
|
||||
static final GetServerDefaultsRequestProto VOID_GET_SERVER_DEFAULT_REQUEST =
|
||||
GetServerDefaultsRequestProto.newBuilder().build();
|
||||
|
||||
private final static GetFsStatusRequestProto VOID_GET_FSSTATUS_REQUEST =
|
||||
GetFsStatusRequestProto.newBuilder().build();
|
||||
|
||||
private final static SaveNamespaceRequestProto VOID_SAVE_NAMESPACE_REQUEST =
|
||||
SaveNamespaceRequestProto.newBuilder().build();
|
||||
|
||||
private final static RollEditsRequestProto VOID_ROLLEDITS_REQUEST =
|
||||
RollEditsRequestProto.getDefaultInstance();
|
||||
|
||||
private final static RefreshNodesRequestProto VOID_REFRESH_NODES_REQUEST =
|
||||
RefreshNodesRequestProto.newBuilder().build();
|
||||
|
||||
private final static FinalizeUpgradeRequestProto
|
||||
VOID_FINALIZE_UPGRADE_REQUEST =
|
||||
FinalizeUpgradeRequestProto.newBuilder().build();
|
||||
|
||||
private final static GetDataEncryptionKeyRequestProto
|
||||
VOID_GET_DATA_ENCRYPTIONKEY_REQUEST =
|
||||
GetDataEncryptionKeyRequestProto.newBuilder().build();
|
||||
|
||||
public ClientNamenodeProtocolTranslatorPB(ClientNamenodeProtocolPB proxy) {
|
||||
rpcProxy = proxy;
|
||||
}
|
||||
|
@ -160,7 +183,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
|
||||
@Override
|
||||
public FsServerDefaults getServerDefaults() throws IOException {
|
||||
GetServerDefaultsRequestProto req = GetServerDefaultsRequestProto.newBuilder().build();
|
||||
GetServerDefaultsRequestProto req = VOID_GET_SERVER_DEFAULT_REQUEST;
|
||||
try {
|
||||
return PBHelper
|
||||
.convert(rpcProxy.getServerDefaults(null, req).getServerDefaults());
|
||||
|
@ -473,9 +496,9 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
|
||||
@Override
|
||||
public long[] getStats() throws IOException {
|
||||
GetFsStatusRequestProto req = GetFsStatusRequestProto.newBuilder().build();
|
||||
try {
|
||||
return PBHelper.convert(rpcProxy.getFsStats(null, req));
|
||||
return PBHelper.convert(rpcProxy.getFsStats(null,
|
||||
VOID_GET_FSSTATUS_REQUEST));
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
@ -522,10 +545,8 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
|
||||
@Override
|
||||
public void saveNamespace() throws AccessControlException, IOException {
|
||||
SaveNamespaceRequestProto req = SaveNamespaceRequestProto.newBuilder()
|
||||
.build();
|
||||
try {
|
||||
rpcProxy.saveNamespace(null, req);
|
||||
rpcProxy.saveNamespace(null, VOID_SAVE_NAMESPACE_REQUEST);
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
@ -533,9 +554,9 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
|
||||
@Override
|
||||
public long rollEdits() throws AccessControlException, IOException {
|
||||
RollEditsRequestProto req = RollEditsRequestProto.getDefaultInstance();
|
||||
try {
|
||||
RollEditsResponseProto resp = rpcProxy.rollEdits(null, req);
|
||||
RollEditsResponseProto resp = rpcProxy.rollEdits(null,
|
||||
VOID_ROLLEDITS_REQUEST);
|
||||
return resp.getNewSegmentTxId();
|
||||
} catch (ServiceException se) {
|
||||
throw ProtobufHelper.getRemoteException(se);
|
||||
|
@ -557,9 +578,8 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
|
||||
@Override
|
||||
public void refreshNodes() throws IOException {
|
||||
RefreshNodesRequestProto req = RefreshNodesRequestProto.newBuilder().build();
|
||||
try {
|
||||
rpcProxy.refreshNodes(null, req);
|
||||
rpcProxy.refreshNodes(null, VOID_REFRESH_NODES_REQUEST);
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
@ -567,9 +587,8 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
|
||||
@Override
|
||||
public void finalizeUpgrade() throws IOException {
|
||||
FinalizeUpgradeRequestProto req = FinalizeUpgradeRequestProto.newBuilder().build();
|
||||
try {
|
||||
rpcProxy.finalizeUpgrade(null, req);
|
||||
rpcProxy.finalizeUpgrade(null, VOID_FINALIZE_UPGRADE_REQUEST);
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
@ -818,11 +837,9 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
|
||||
@Override
|
||||
public DataEncryptionKey getDataEncryptionKey() throws IOException {
|
||||
GetDataEncryptionKeyRequestProto req = GetDataEncryptionKeyRequestProto
|
||||
.newBuilder().build();
|
||||
try {
|
||||
GetDataEncryptionKeyResponseProto rsp =
|
||||
rpcProxy.getDataEncryptionKey(null, req);
|
||||
GetDataEncryptionKeyResponseProto rsp = rpcProxy.getDataEncryptionKey(
|
||||
null, VOID_GET_DATA_ENCRYPTIONKEY_REQUEST);
|
||||
return rsp.hasDataEncryptionKey() ?
|
||||
PBHelper.convert(rsp.getDataEncryptionKey()) : null;
|
||||
} catch (ServiceException e) {
|
||||
|
|
|
@ -84,7 +84,7 @@ public class DatanodeProtocolClientSideTranslatorPB implements
|
|||
|
||||
/** RpcController is not used and hence is set to null */
|
||||
private final DatanodeProtocolPB rpcProxy;
|
||||
private static final VersionRequestProto VERSION_REQUEST =
|
||||
private static final VersionRequestProto VOID_VERSION_REQUEST =
|
||||
VersionRequestProto.newBuilder().build();
|
||||
private final static RpcController NULL_CONTROLLER = null;
|
||||
|
||||
|
@ -243,7 +243,7 @@ public class DatanodeProtocolClientSideTranslatorPB implements
|
|||
public NamespaceInfo versionRequest() throws IOException {
|
||||
try {
|
||||
return PBHelper.convert(rpcProxy.versionRequest(NULL_CONTROLLER,
|
||||
VERSION_REQUEST).getInfo());
|
||||
VOID_VERSION_REQUEST).getInfo());
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
|
|
@ -62,15 +62,17 @@ public class DatanodeProtocolServerSideTranslatorPB implements
|
|||
DatanodeProtocolPB {
|
||||
|
||||
private final DatanodeProtocol impl;
|
||||
private static final ErrorReportResponseProto ERROR_REPORT_RESPONSE_PROTO =
|
||||
private static final ErrorReportResponseProto
|
||||
VOID_ERROR_REPORT_RESPONSE_PROTO =
|
||||
ErrorReportResponseProto.newBuilder().build();
|
||||
private static final BlockReceivedAndDeletedResponseProto
|
||||
BLOCK_RECEIVED_AND_DELETE_RESPONSE =
|
||||
VOID_BLOCK_RECEIVED_AND_DELETE_RESPONSE =
|
||||
BlockReceivedAndDeletedResponseProto.newBuilder().build();
|
||||
private static final ReportBadBlocksResponseProto REPORT_BAD_BLOCK_RESPONSE =
|
||||
private static final ReportBadBlocksResponseProto
|
||||
VOID_REPORT_BAD_BLOCK_RESPONSE =
|
||||
ReportBadBlocksResponseProto.newBuilder().build();
|
||||
private static final CommitBlockSynchronizationResponseProto
|
||||
COMMIT_BLOCK_SYNCHRONIZATION_RESPONSE_PROTO =
|
||||
VOID_COMMIT_BLOCK_SYNCHRONIZATION_RESPONSE_PROTO =
|
||||
CommitBlockSynchronizationResponseProto.newBuilder().build();
|
||||
|
||||
public DatanodeProtocolServerSideTranslatorPB(DatanodeProtocol impl) {
|
||||
|
@ -180,7 +182,7 @@ public class DatanodeProtocolServerSideTranslatorPB implements
|
|||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
return BLOCK_RECEIVED_AND_DELETE_RESPONSE;
|
||||
return VOID_BLOCK_RECEIVED_AND_DELETE_RESPONSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -192,7 +194,7 @@ public class DatanodeProtocolServerSideTranslatorPB implements
|
|||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
return ERROR_REPORT_RESPONSE_PROTO;
|
||||
return VOID_ERROR_REPORT_RESPONSE_PROTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -221,7 +223,7 @@ public class DatanodeProtocolServerSideTranslatorPB implements
|
|||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
return REPORT_BAD_BLOCK_RESPONSE;
|
||||
return VOID_REPORT_BAD_BLOCK_RESPONSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -242,6 +244,6 @@ public class DatanodeProtocolServerSideTranslatorPB implements
|
|||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
return COMMIT_BLOCK_SYNCHRONIZATION_RESPONSE_PROTO;
|
||||
return VOID_COMMIT_BLOCK_SYNCHRONIZATION_RESPONSE_PROTO;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,13 @@ public class JournalProtocolServerSideTranslatorPB implements JournalProtocolPB
|
|||
/** Server side implementation to delegate the requests to */
|
||||
private final JournalProtocol impl;
|
||||
|
||||
private final static JournalResponseProto VOID_JOURNAL_RESPONSE =
|
||||
JournalResponseProto.newBuilder().build();
|
||||
|
||||
private final static StartLogSegmentResponseProto
|
||||
VOID_START_LOG_SEGMENT_RESPONSE =
|
||||
StartLogSegmentResponseProto.newBuilder().build();
|
||||
|
||||
public JournalProtocolServerSideTranslatorPB(JournalProtocol impl) {
|
||||
this.impl = impl;
|
||||
}
|
||||
|
@ -56,7 +63,7 @@ public class JournalProtocolServerSideTranslatorPB implements JournalProtocolPB
|
|||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
return JournalResponseProto.newBuilder().build();
|
||||
return VOID_JOURNAL_RESPONSE;
|
||||
}
|
||||
|
||||
/** @see JournalProtocol#startLogSegment */
|
||||
|
@ -69,7 +76,7 @@ public class JournalProtocolServerSideTranslatorPB implements JournalProtocolPB
|
|||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
return StartLogSegmentResponseProto.newBuilder().build();
|
||||
return VOID_START_LOG_SEGMENT_RESPONSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -63,6 +63,12 @@ public class NamenodeProtocolServerSideTranslatorPB implements
|
|||
NamenodeProtocolPB {
|
||||
private final NamenodeProtocol impl;
|
||||
|
||||
private final static ErrorReportResponseProto VOID_ERROR_REPORT_RESPONSE =
|
||||
ErrorReportResponseProto.newBuilder().build();
|
||||
|
||||
private final static EndCheckpointResponseProto VOID_END_CHECKPOINT_RESPONSE =
|
||||
EndCheckpointResponseProto.newBuilder().build();
|
||||
|
||||
public NamenodeProtocolServerSideTranslatorPB(NamenodeProtocol impl) {
|
||||
this.impl = impl;
|
||||
}
|
||||
|
@ -147,7 +153,7 @@ public class NamenodeProtocolServerSideTranslatorPB implements
|
|||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
return ErrorReportResponseProto.newBuilder().build();
|
||||
return VOID_ERROR_REPORT_RESPONSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -185,7 +191,7 @@ public class NamenodeProtocolServerSideTranslatorPB implements
|
|||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
return EndCheckpointResponseProto.newBuilder().build();
|
||||
return VOID_END_CHECKPOINT_RESPONSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -68,13 +68,13 @@ public class NamenodeProtocolTranslatorPB implements NamenodeProtocol,
|
|||
/*
|
||||
* Protobuf requests with no parameters instantiated only once
|
||||
*/
|
||||
private static final GetBlockKeysRequestProto GET_BLOCKKEYS =
|
||||
private static final GetBlockKeysRequestProto VOID_GET_BLOCKKEYS_REQUEST =
|
||||
GetBlockKeysRequestProto.newBuilder().build();
|
||||
private static final GetTransactionIdRequestProto GET_TRANSACTIONID =
|
||||
private static final GetTransactionIdRequestProto VOID_GET_TRANSACTIONID_REQUEST =
|
||||
GetTransactionIdRequestProto.newBuilder().build();
|
||||
private static final RollEditLogRequestProto ROLL_EDITLOG =
|
||||
private static final RollEditLogRequestProto VOID_ROLL_EDITLOG_REQUEST =
|
||||
RollEditLogRequestProto.newBuilder().build();
|
||||
private static final VersionRequestProto VERSION_REQUEST =
|
||||
private static final VersionRequestProto VOID_VERSION_REQUEST =
|
||||
VersionRequestProto.newBuilder().build();
|
||||
|
||||
final private NamenodeProtocolPB rpcProxy;
|
||||
|
@ -106,7 +106,7 @@ public class NamenodeProtocolTranslatorPB implements NamenodeProtocol,
|
|||
public ExportedBlockKeys getBlockKeys() throws IOException {
|
||||
try {
|
||||
GetBlockKeysResponseProto rsp = rpcProxy.getBlockKeys(NULL_CONTROLLER,
|
||||
GET_BLOCKKEYS);
|
||||
VOID_GET_BLOCKKEYS_REQUEST);
|
||||
return rsp.hasKeys() ? PBHelper.convert(rsp.getKeys()) : null;
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
|
@ -116,8 +116,8 @@ public class NamenodeProtocolTranslatorPB implements NamenodeProtocol,
|
|||
@Override
|
||||
public long getTransactionID() throws IOException {
|
||||
try {
|
||||
return rpcProxy.getTransactionId(NULL_CONTROLLER, GET_TRANSACTIONID)
|
||||
.getTxId();
|
||||
return rpcProxy.getTransactionId(NULL_CONTROLLER,
|
||||
VOID_GET_TRANSACTIONID_REQUEST).getTxId();
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class NamenodeProtocolTranslatorPB implements NamenodeProtocol,
|
|||
public CheckpointSignature rollEditLog() throws IOException {
|
||||
try {
|
||||
return PBHelper.convert(rpcProxy.rollEditLog(NULL_CONTROLLER,
|
||||
ROLL_EDITLOG).getSignature());
|
||||
VOID_ROLL_EDITLOG_REQUEST).getSignature());
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ public class NamenodeProtocolTranslatorPB implements NamenodeProtocol,
|
|||
public NamespaceInfo versionRequest() throws IOException {
|
||||
try {
|
||||
return PBHelper.convert(rpcProxy.versionRequest(NULL_CONTROLLER,
|
||||
VERSION_REQUEST).getInfo());
|
||||
VOID_VERSION_REQUEST).getInfo());
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,10 @@ public class RefreshAuthorizationPolicyProtocolClientSideTranslatorPB implements
|
|||
private final static RpcController NULL_CONTROLLER = null;
|
||||
private final RefreshAuthorizationPolicyProtocolPB rpcProxy;
|
||||
|
||||
private final static RefreshServiceAclRequestProto
|
||||
VOID_REFRESH_SERVICE_ACL_REQUEST =
|
||||
RefreshServiceAclRequestProto.newBuilder().build();
|
||||
|
||||
public RefreshAuthorizationPolicyProtocolClientSideTranslatorPB(
|
||||
RefreshAuthorizationPolicyProtocolPB rpcProxy) {
|
||||
this.rpcProxy = rpcProxy;
|
||||
|
@ -50,10 +54,9 @@ public class RefreshAuthorizationPolicyProtocolClientSideTranslatorPB implements
|
|||
|
||||
@Override
|
||||
public void refreshServiceAcl() throws IOException {
|
||||
RefreshServiceAclRequestProto request = RefreshServiceAclRequestProto
|
||||
.newBuilder().build();
|
||||
try {
|
||||
rpcProxy.refreshServiceAcl(NULL_CONTROLLER, request);
|
||||
rpcProxy.refreshServiceAcl(NULL_CONTROLLER,
|
||||
VOID_REFRESH_SERVICE_ACL_REQUEST);
|
||||
} catch (ServiceException se) {
|
||||
throw ProtobufHelper.getRemoteException(se);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,10 @@ public class RefreshAuthorizationPolicyProtocolServerSideTranslatorPB implements
|
|||
|
||||
private final RefreshAuthorizationPolicyProtocol impl;
|
||||
|
||||
private final static RefreshServiceAclResponseProto
|
||||
VOID_REFRESH_SERVICE_ACL_RESPONSE = RefreshServiceAclResponseProto
|
||||
.newBuilder().build();
|
||||
|
||||
public RefreshAuthorizationPolicyProtocolServerSideTranslatorPB(
|
||||
RefreshAuthorizationPolicyProtocol impl) {
|
||||
this.impl = impl;
|
||||
|
@ -46,6 +50,6 @@ public class RefreshAuthorizationPolicyProtocolServerSideTranslatorPB implements
|
|||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
return RefreshServiceAclResponseProto.newBuilder().build();
|
||||
return VOID_REFRESH_SERVICE_ACL_RESPONSE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,14 @@ public class RefreshUserMappingsProtocolClientSideTranslatorPB implements
|
|||
private final static RpcController NULL_CONTROLLER = null;
|
||||
private final RefreshUserMappingsProtocolPB rpcProxy;
|
||||
|
||||
private final static RefreshUserToGroupsMappingsRequestProto
|
||||
VOID_REFRESH_USER_TO_GROUPS_MAPPING_REQUEST =
|
||||
RefreshUserToGroupsMappingsRequestProto.newBuilder().build();
|
||||
|
||||
private final static RefreshSuperUserGroupsConfigurationRequestProto
|
||||
VOID_REFRESH_SUPERUSER_GROUPS_CONFIGURATION_REQUEST =
|
||||
RefreshSuperUserGroupsConfigurationRequestProto.newBuilder().build();
|
||||
|
||||
public RefreshUserMappingsProtocolClientSideTranslatorPB(
|
||||
RefreshUserMappingsProtocolPB rpcProxy) {
|
||||
this.rpcProxy = rpcProxy;
|
||||
|
@ -51,10 +59,9 @@ public class RefreshUserMappingsProtocolClientSideTranslatorPB implements
|
|||
|
||||
@Override
|
||||
public void refreshUserToGroupsMappings() throws IOException {
|
||||
RefreshUserToGroupsMappingsRequestProto request =
|
||||
RefreshUserToGroupsMappingsRequestProto.newBuilder().build();
|
||||
try {
|
||||
rpcProxy.refreshUserToGroupsMappings(NULL_CONTROLLER, request);
|
||||
rpcProxy.refreshUserToGroupsMappings(NULL_CONTROLLER,
|
||||
VOID_REFRESH_USER_TO_GROUPS_MAPPING_REQUEST);
|
||||
} catch (ServiceException se) {
|
||||
throw ProtobufHelper.getRemoteException(se);
|
||||
}
|
||||
|
@ -62,10 +69,9 @@ public class RefreshUserMappingsProtocolClientSideTranslatorPB implements
|
|||
|
||||
@Override
|
||||
public void refreshSuperUserGroupsConfiguration() throws IOException {
|
||||
RefreshSuperUserGroupsConfigurationRequestProto request =
|
||||
RefreshSuperUserGroupsConfigurationRequestProto.newBuilder().build();
|
||||
try {
|
||||
rpcProxy.refreshSuperUserGroupsConfiguration(NULL_CONTROLLER, request);
|
||||
rpcProxy.refreshSuperUserGroupsConfiguration(NULL_CONTROLLER,
|
||||
VOID_REFRESH_SUPERUSER_GROUPS_CONFIGURATION_REQUEST);
|
||||
} catch (ServiceException se) {
|
||||
throw ProtobufHelper.getRemoteException(se);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,15 @@ public class RefreshUserMappingsProtocolServerSideTranslatorPB implements Refres
|
|||
|
||||
private final RefreshUserMappingsProtocol impl;
|
||||
|
||||
private final static RefreshUserToGroupsMappingsResponseProto
|
||||
VOID_REFRESH_USER_GROUPS_MAPPING_RESPONSE =
|
||||
RefreshUserToGroupsMappingsResponseProto.newBuilder().build();
|
||||
|
||||
private final static RefreshSuperUserGroupsConfigurationResponseProto
|
||||
VOID_REFRESH_SUPERUSER_GROUPS_CONFIGURATION_RESPONSE =
|
||||
RefreshSuperUserGroupsConfigurationResponseProto.newBuilder()
|
||||
.build();
|
||||
|
||||
public RefreshUserMappingsProtocolServerSideTranslatorPB(RefreshUserMappingsProtocol impl) {
|
||||
this.impl = impl;
|
||||
}
|
||||
|
@ -47,7 +56,7 @@ public class RefreshUserMappingsProtocolServerSideTranslatorPB implements Refres
|
|||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
return RefreshUserToGroupsMappingsResponseProto.newBuilder().build();
|
||||
return VOID_REFRESH_USER_GROUPS_MAPPING_RESPONSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,7 +69,6 @@ public class RefreshUserMappingsProtocolServerSideTranslatorPB implements Refres
|
|||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
return RefreshSuperUserGroupsConfigurationResponseProto.newBuilder()
|
||||
.build();
|
||||
return VOID_REFRESH_SUPERUSER_GROUPS_CONFIGURATION_RESPONSE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,6 +65,13 @@ public class QJournalProtocolServerSideTranslatorPB implements QJournalProtocolP
|
|||
/** Server side implementation to delegate the requests to */
|
||||
private final QJournalProtocol impl;
|
||||
|
||||
private final static JournalResponseProto VOID_JOURNAL_RESPONSE =
|
||||
JournalResponseProto.newBuilder().build();
|
||||
|
||||
private final static StartLogSegmentResponseProto
|
||||
VOID_START_LOG_SEGMENT_RESPONSE =
|
||||
StartLogSegmentResponseProto.newBuilder().build();
|
||||
|
||||
public QJournalProtocolServerSideTranslatorPB(QJournalProtocol impl) {
|
||||
this.impl = impl;
|
||||
}
|
||||
|
@ -135,7 +142,7 @@ public class QJournalProtocolServerSideTranslatorPB implements QJournalProtocolP
|
|||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
return JournalResponseProto.newBuilder().build();
|
||||
return VOID_JOURNAL_RESPONSE;
|
||||
}
|
||||
|
||||
/** @see JournalProtocol#heartbeat */
|
||||
|
@ -160,7 +167,7 @@ public class QJournalProtocolServerSideTranslatorPB implements QJournalProtocolP
|
|||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
return StartLogSegmentResponseProto.newBuilder().build();
|
||||
return VOID_START_LOG_SEGMENT_RESPONSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -168,7 +168,7 @@ message RenameRequestProto {
|
|||
required string dst = 2;
|
||||
}
|
||||
|
||||
message RenameResponseProto { // void response
|
||||
message RenameResponseProto {
|
||||
required bool result = 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue