Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*-
   * See the file LICENSE for redistribution information.
   *
   * Copyright (c) 2002, 2013 Oracle and/or its affiliates.  All rights reserved.
   *
   */
  
  package com.sleepycat.je.rep;
  

This exception is thrown at the time of a commit in a Master, if the Master could not obtain transaction commit acknowledgments from its Replicas in accordance with the com.sleepycat.je.Durability.ReplicaAckPolicy currently in effect. This exception will never be thrown when the ReplicaAckPolicy of NONE is in effect.

Note that a InsufficientAcksException does not indicate there was a failure to commit the transaction on the master. The transaction has in fact been successfully committed on the master at the time of the exception.

The application can handle the exception and use it to take some form of administrative action. For example, it may log messages to have the operations staff look into the health of the replicas or the network. Or it may decide to increase the durability of the transaction on the Master by ensuring that the changes are flushed to the operating system's buffers or to the disk itself.

The application may additionally choose to continue to create new transactions, which may succeed or fail depending on whether the underlying problems have been resolved.

 
     private static final long serialVersionUID = 1;
 
     private final int acksPending;
     private final int acksRequired;
     private final int ackTimeoutMs;
     private final String feederState;

    

Parameters:
acksPending the number of missing acknowledgments
ackTimeoutMs the current acknowledgment timeout value in milliseconds
Hidden:
Creates a InsufficientAcksException.
 
     public InsufficientAcksException(MasterTxn txn,
                                      int acksPending,
                                      int ackTimeoutMs,
                                      String feederState) {
         super(nullfalse /*abortOnly*/,
               "Transaction: " + txn.getId() +
               "  VLSN: " + txn.getCommitVLSN() +
               ", initiated at: " + String.format("%1tT. "txn.getStartMs()) +
               " Insufficient acks for policy:" +
               txn.getCommitDurability().getReplicaAck() + ". " +
               "Need replica acks: " + txn.getRequiredAckCount() + ". " +
               "Missing replica acks: " + acksPending + ". " +
               "Timeout: " + ackTimeoutMs + "ms. " +
               "FeederState=" + feederState,
               null /*cause*/);
         assert(acksPending <= txn.getRequiredAckCount());
         this. = acksPending;
         this. = txn.getRequiredAckCount();
         this. = ackTimeoutMs;
         this. = feederState;
     }

    
For internal use only.

Hidden:
 
     private InsufficientAcksException(String message,
                                       InsufficientAcksException cause) {
         super(messagecause);
         this. = cause.acksPending;
         this. = cause.acksRequired;
         this. = cause.ackTimeoutMs;
         this. = cause.feederState;
     }

    
For internal use only.

Hidden:
 
     @Override
     public OperationFailureException wrapSelf(String msg) {
         return new InsufficientAcksException(msgthis);
     }

    
It returns the number of Replicas that did not respond with an acknowledgment within the Replica commit timeout period.

Returns:
the number of missing acknowledgments
    public int acksPending() {
        return ;
    }

    
It returns the number of acknowledgments required by the commit policy.

Returns:
the number of acknowledgments required
    public int acksRequired() {
        return ;
    }

    
Returns the acknowledgment timeout that was in effect at the time of the exception.

Returns:
the acknowledgment timeout in milliseconds
    public int ackTimeout() {
        return ;
    }
New to GrepCode? Check out our FAQ X