@InterfaceAudience.Private public class ServerNonceManager extends Object
Modifier and Type | Class and Description |
---|---|
private static class |
ServerNonceManager.OperationContext |
Modifier and Type | Field and Description |
---|---|
private int |
conflictWaitIterationMs
The time to wait in an extremely unlikely case of a conflict with a running op.
|
private int |
deleteNonceGracePeriod |
static String |
HASH_NONCE_GRACE_PERIOD_KEY |
private static org.apache.commons.logging.Log |
LOG |
private ConcurrentHashMap<NonceKey,ServerNonceManager.OperationContext> |
nonces
Nonces.
|
private static SimpleDateFormat |
tsFormat |
Constructor and Description |
---|
ServerNonceManager(org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
private void |
cleanUpOldNonces() |
ScheduledChore |
createCleanupScheduledChore(Stoppable stoppable)
Creates a scheduled chore that is used to clean up old nonces.
|
void |
endOperation(long group,
long nonce,
boolean success)
Ends the operation started by startOperation.
|
void |
reportOperationFromWal(long group,
long nonce,
long writeTime)
Reports the operation from WAL during replay.
|
void |
setConflictWaitIterationMs(int conflictWaitIterationMs) |
boolean |
startOperation(long group,
long nonce,
Stoppable stoppable)
Starts the operation if operation with such nonce has not already succeeded.
|
public static final String HASH_NONCE_GRACE_PERIOD_KEY
private static final org.apache.commons.logging.Log LOG
private int conflictWaitIterationMs
private static final SimpleDateFormat tsFormat
private ConcurrentHashMap<NonceKey,ServerNonceManager.OperationContext> nonces
private int deleteNonceGracePeriod
public ServerNonceManager(org.apache.hadoop.conf.Configuration conf)
public void setConflictWaitIterationMs(int conflictWaitIterationMs)
public boolean startOperation(long group, long nonce, Stoppable stoppable) throws InterruptedException
group
- Nonce group.nonce
- Nonce.stoppable
- Stoppable that terminates waiting (if any) when the server is stopped.InterruptedException
public void endOperation(long group, long nonce, boolean success)
group
- Nonce group.nonce
- Nonce.success
- Whether the operation has succeeded.public void reportOperationFromWal(long group, long nonce, long writeTime)
group
- Nonce group.nonce
- Nonce.writeTime
- Entry write time, used to ignore entries that are too old.public ScheduledChore createCleanupScheduledChore(Stoppable stoppable)
stoppable
- Stoppable for the chore.private void cleanUpOldNonces()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.