Search in sources :

Example 6 with HistoryServerState

use of org.apache.hadoop.mapreduce.v2.hs.HistoryServerStateStoreService.HistoryServerState in project hadoop by apache.

the class HistoryServerFileSystemStateStoreService method loadToken.

private MRDelegationTokenIdentifier loadToken(HistoryServerState state, Path tokenFile, long numTokenFileBytes) throws IOException {
    MRDelegationTokenIdentifier tokenId = new MRDelegationTokenIdentifier();
    long renewDate;
    byte[] tokenData = readFile(tokenFile, numTokenFileBytes);
    DataInputStream in = new DataInputStream(new ByteArrayInputStream(tokenData));
    try {
        tokenId.readFields(in);
        renewDate = in.readLong();
    } finally {
        IOUtils.cleanup(LOG, in);
    }
    state.tokenState.put(tokenId, renewDate);
    return tokenId;
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) MRDelegationTokenIdentifier(org.apache.hadoop.mapreduce.v2.api.MRDelegationTokenIdentifier) DataInputStream(java.io.DataInputStream) FSDataInputStream(org.apache.hadoop.fs.FSDataInputStream)

Aggregations

MRDelegationTokenIdentifier (org.apache.hadoop.mapreduce.v2.api.MRDelegationTokenIdentifier)6 IOException (java.io.IOException)3 Text (org.apache.hadoop.io.Text)3 HistoryServerState (org.apache.hadoop.mapreduce.v2.hs.HistoryServerStateStoreService.HistoryServerState)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 DataInputStream (java.io.DataInputStream)2 DelegationKey (org.apache.hadoop.security.token.delegation.DelegationKey)2 Test (org.junit.Test)2 FSDataInputStream (org.apache.hadoop.fs.FSDataInputStream)1 FileSystem (org.apache.hadoop.fs.FileSystem)1 Path (org.apache.hadoop.fs.Path)1 ArgumentMatcher (org.mockito.ArgumentMatcher)1