use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RenewDelegationTokenResponseProto in project ozone by apache.
the class OzoneManagerProtocolClientSideTranslatorPB method renewDelegationToken.
/**
* Renew an existing delegation token.
*
* @param token delegation token obtained earlier
* @return the new expiration time
*/
@Override
public long renewDelegationToken(Token<OzoneTokenIdentifier> token) throws OMException {
RenewDelegationTokenRequestProto req = RenewDelegationTokenRequestProto.newBuilder().setToken(OMPBHelper.convertToTokenProto(token)).build();
OMRequest omRequest = createOMRequest(Type.RenewDelegationToken).setRenewDelegationTokenRequest(req).build();
final RenewDelegationTokenResponseProto resp;
try {
resp = handleError(submitRequest(omRequest)).getRenewDelegationTokenResponse();
return resp.getResponse().getNewExpiryTime();
} catch (IOException e) {
if (e instanceof OMException) {
throw (OMException) e;
}
throw new OMException("Renew delegation token failed.", e, TOKEN_ERROR_OTHER);
}
}
Aggregations