HADOOP-6596. Add a version field to the AbstractDelegationTokenIdentifier's

serialized value. (omalley)


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@916390 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Owen O'Malley 2010-02-25 18:34:05 +00:00
parent 831da66493
commit 37214591e9
2 changed files with 10 additions and 0 deletions

View File

@ -164,6 +164,9 @@ Trunk (unreleased changes)
HADOOP-6579. Provide a mechanism for encoding/decoding Tokens from HADOOP-6579. Provide a mechanism for encoding/decoding Tokens from
a url-safe string and change the commons-code library to 1.4. (omalley) a url-safe string and change the commons-code library to 1.4. (omalley)
HADOOP-6596. Add a version field to the AbstractDelegationTokenIdentifier's
serialized value. (omalley)
OPTIMIZATIONS OPTIMIZATIONS
HADOOP-6467. Improve the performance on HarFileSystem.listStatus(..). HADOOP-6467. Improve the performance on HarFileSystem.listStatus(..).

View File

@ -34,6 +34,7 @@ import org.apache.hadoop.security.token.TokenIdentifier;
@InterfaceAudience.LimitedPrivate({HDFS, MAPREDUCE}) @InterfaceAudience.LimitedPrivate({HDFS, MAPREDUCE})
public abstract class AbstractDelegationTokenIdentifier public abstract class AbstractDelegationTokenIdentifier
extends TokenIdentifier { extends TokenIdentifier {
private static final byte VERSION = 0;
private Text owner; private Text owner;
private Text renewer; private Text renewer;
@ -145,6 +146,11 @@ extends TokenIdentifier {
} }
public void readFields(DataInput in) throws IOException { public void readFields(DataInput in) throws IOException {
byte version = in.readByte();
if (version != VERSION) {
throw new IOException("Unknown version of delegation token " +
version);
}
owner.readFields(in); owner.readFields(in);
renewer.readFields(in); renewer.readFields(in);
realUser.readFields(in); realUser.readFields(in);
@ -155,6 +161,7 @@ extends TokenIdentifier {
} }
public void write(DataOutput out) throws IOException { public void write(DataOutput out) throws IOException {
out.writeByte(VERSION);
owner.write(out); owner.write(out);
renewer.write(out); renewer.write(out);
realUser.write(out); realUser.write(out);