org.apache.hadoop.hbase.regionserver
Class ServerNonceManager

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.ServerNonceManager

@InterfaceAudience.Private
public class ServerNonceManager
extends Object

Implementation of nonce manager that stores nonces in a hash map and cleans them up after some time; if nonce group/client ID is supplied, nonces are stored by client ID.


Field Summary
static String HASH_NONCE_GRACE_PERIOD_KEY
           
 
Constructor Summary
ServerNonceManager(org.apache.hadoop.conf.Configuration conf)
           
 
Method Summary
 Chore createCleanupChore(Stoppable stoppable)
          Creates a 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HASH_NONCE_GRACE_PERIOD_KEY

public static final String HASH_NONCE_GRACE_PERIOD_KEY
See Also:
Constant Field Values
Constructor Detail

ServerNonceManager

public ServerNonceManager(org.apache.hadoop.conf.Configuration conf)
Method Detail

setConflictWaitIterationMs

public void setConflictWaitIterationMs(int conflictWaitIterationMs)

startOperation

public boolean startOperation(long group,
                              long nonce,
                              Stoppable stoppable)
                       throws InterruptedException
Starts the operation if operation with such nonce has not already succeeded. If the operation is in progress, waits for it to end and checks whether it has succeeded.

Parameters:
group - Nonce group.
nonce - Nonce.
stoppable - Stoppable that terminates waiting (if any) when the server is stopped.
Returns:
true if the operation has not already succeeded and can proceed; false otherwise.
Throws:
InterruptedException

endOperation

public void endOperation(long group,
                         long nonce,
                         boolean success)
Ends the operation started by startOperation.

Parameters:
group - Nonce group.
nonce - Nonce.
success - Whether the operation has succeeded.

reportOperationFromWal

public void reportOperationFromWal(long group,
                                   long nonce,
                                   long writeTime)
Reports the operation from WAL during replay.

Parameters:
group - Nonce group.
nonce - Nonce.
writeTime - Entry write time, used to ignore entries that are too old.

createCleanupChore

public Chore createCleanupChore(Stoppable stoppable)
Creates a chore that is used to clean up old nonces.

Parameters:
stoppable - Stoppable for the chore.
Returns:
Chore; the chore is not started.


Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.