private static Optional < Token < ? > > getTokenFromSeqFile ( String authPath , String proxyUserName ) throws IOException { try ( Closer closer = Closer . create ( ) ) { FileSystem localFs = FileSystem . getLocal ( new Configuration ( ) ) ; SequenceFile . Reader tokenReader = closer . register ( new SequenceFile . Reader ( localFs , new Path ( authPath ) , localFs . getConf ( ) ) ) ; Text key = new Text ( ) ; Token < ? > value = new Token <> ( ) ; while ( tokenReader . next ( key , value ) ) { LOG . info ( "Found token for " + key ) ; if ( key . toString ( ) . equals ( proxyUserName ) ) { return Optional . < Token < ? > > of ( value ) ; } } } return Optional . absent ( ) ; }
Get token from the token sequence file .