Search in sources :

Example 1 with RenewDelegationTokenResponseProto

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);
    }
}
Also used : OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) RenewDelegationTokenResponseProto(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RenewDelegationTokenResponseProto) RenewDelegationTokenRequestProto(org.apache.hadoop.ozone.security.proto.SecurityProtos.RenewDelegationTokenRequestProto) IOException(java.io.IOException) OMException(org.apache.hadoop.ozone.om.exceptions.OMException)

Aggregations

IOException (java.io.IOException)1 OMException (org.apache.hadoop.ozone.om.exceptions.OMException)1 OMRequest (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest)1 RenewDelegationTokenResponseProto (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RenewDelegationTokenResponseProto)1 RenewDelegationTokenRequestProto (org.apache.hadoop.ozone.security.proto.SecurityProtos.RenewDelegationTokenRequestProto)1