private BlockTokenSecretManager(boolean isMaster, long keyUpdateInterval, long tokenLifetime, String blockPoolId, String encryptionAlgorithm, int nnIndex, int numNNs, boolean useProto) { this.intRange = Integer.MAX_VALUE / numNNs; this.nnRangeStart = intRange * nnIndex; this.isMaster = isMaster; this.keyUpdateInterval = keyUpdateInterval; this.tokenLifetime = tokenLifetime; this.allKeys = new HashMap<Integer, BlockKey>(); this.blockPoolId = blockPoolId; this.encryptionAlgorithm = encryptionAlgorithm; this.useProto = useProto; this.timer = new Timer(); generateKeys(); }
/** * Constructor for masters. * * @param keyUpdateInterval how often a new key will be generated * @param tokenLifetime how long an individual token is valid * @param nnIndex namenode index of the namenode for which we are creating the manager * @param blockPoolId block pool ID * @param encryptionAlgorithm encryption algorithm to use * @param numNNs number of namenodes possible * @param useProto should we use new protobuf style tokens */ public BlockTokenSecretManager(long keyUpdateInterval, long tokenLifetime, int nnIndex, int numNNs, String blockPoolId, String encryptionAlgorithm, boolean useProto) { this(true, keyUpdateInterval, tokenLifetime, blockPoolId, encryptionAlgorithm, nnIndex, numNNs, useProto); Preconditions.checkArgument(nnIndex >= 0); Preconditions.checkArgument(numNNs > 0); setSerialNo(new SecureRandom().nextInt()); generateKeys(); }
private BlockTokenSecretManager(boolean isMaster, long keyUpdateInterval, long tokenLifetime, String blockPoolId, String encryptionAlgorithm) { this.isMaster = isMaster; this.keyUpdateInterval = keyUpdateInterval; this.tokenLifetime = tokenLifetime; this.allKeys = new HashMap<Integer, BlockKey>(); this.blockPoolId = blockPoolId; this.encryptionAlgorithm = encryptionAlgorithm; this.timer = new Timer(); generateKeys(); }
private BlockTokenSecretManager(boolean isMaster, long keyUpdateInterval, long tokenLifetime, String blockPoolId, String encryptionAlgorithm) { this.isMaster = isMaster; this.keyUpdateInterval = keyUpdateInterval; this.tokenLifetime = tokenLifetime; this.allKeys = new HashMap<Integer, BlockKey>(); this.blockPoolId = blockPoolId; this.encryptionAlgorithm = encryptionAlgorithm; this.timer = new Timer(); generateKeys(); }
/** * Constructor for masters. * * @param keyUpdateInterval how often a new key will be generated * @param tokenLifetime how long an individual token is valid * @param nnIndex namenode index * @param blockPoolId block pool ID * @param encryptionAlgorithm encryption algorithm to use */ public BlockTokenSecretManager(long keyUpdateInterval, long tokenLifetime, int nnIndex, String blockPoolId, String encryptionAlgorithm) { this(true, keyUpdateInterval, tokenLifetime, blockPoolId, encryptionAlgorithm); Preconditions.checkArgument(nnIndex == 0 || nnIndex == 1); this.nnIndex = nnIndex; setSerialNo(new SecureRandom().nextInt()); generateKeys(); }
/** * Constructor for masters. * * @param keyUpdateInterval how often a new key will be generated * @param tokenLifetime how long an individual token is valid * @param nnIndex namenode index * @param blockPoolId block pool ID * @param encryptionAlgorithm encryption algorithm to use */ public BlockTokenSecretManager(long keyUpdateInterval, long tokenLifetime, int nnIndex, String blockPoolId, String encryptionAlgorithm) { this(true, keyUpdateInterval, tokenLifetime, blockPoolId, encryptionAlgorithm); Preconditions.checkArgument(nnIndex == 0 || nnIndex == 1); this.nnIndex = nnIndex; setSerialNo(new SecureRandom().nextInt()); generateKeys(); }