Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.clustermate.client.call;
  
  public class CallConfig
  {
      // // // Low-level single-call timeout defaults
  
      public final static long DEFAULT_CONNECT_TIMEOUT_MSECS = 600L;
  
      // PUTs can be more expensive; use longer timeouts
     public final static long DEFAULT_PUT_CALL_TIMEOUT_MSECS = 4000L;
 
     // GETs are bit cheaper, can be more aggressive
     public final static long DEFAULT_GET_CALL_TIMEOUT_MSECS = 1000L;
 
     // DELETEs somewhere in between
     public final static long DEFAULT_DELETE_CALL_TIMEOUT_MSECS = 2000L;

    
There is certain minimum practical per-call timeout beyond which we should not reduce timeout (but probably fail the call right away)
 
     public final static long MIN_TIMEOUT_MSECS = 50L;

    
By default, let's just get first 500 ASCII characters (about 6 rows) from error response; might help figure out what is going wrong...
 
     private final static int DEFAULT_MAX_EXCERPT_LENGTH = 500;
 
     
     // // // Low-level single-call timeouts
     
     protected final long _connectTimeoutMsecs;
 
     protected final long _putCallTimeoutMsecs;
 
     protected final long _getCallTimeoutMsecs;
 
     protected final long _deleteCallTimeoutMsecs;
 
     // // // Other settings
 
     protected final int _maxExcerptLength;
     
     /*
     ///////////////////////////////////////////////////////////////////////
     // Instance creation, building
     ///////////////////////////////////////////////////////////////////////
      */
     
     public CallConfig() {
         this(,
                 ,
                 ,
                 ,
                 );
     }
 
     public CallConfig(long connect,
             long putlong getlong delete,
             int maxExcerptLength)
     {
          = connect;
          = put;
          = get;
          = delete;
          = maxExcerptLength;
     }
 
     public CallConfig withConnectTimeout(long t) {
         return (t == ) ? this :
             new CallConfig(t,
                     ,
                     );
     }
 
     public CallConfig withPutTimeout(long t) {
         return (t == ) ? this :
             new CallConfig(
                     t,
                     );
     }
 
     public CallConfig withGetTimeout(long t) {
         return (t == ) ? this :
             new CallConfig(
                     t,
                     );
     }
 
     public CallConfig withDeleteTimeout(long t) {
         return (t == ) ? this :
             new CallConfig(
                     t,
                     );
     }
 
     public CallConfig withMaxExcerptLength(int t) {
         return (t == ) ? this :
            new CallConfig(
                    ,
                    t);
    }
    
    /*
    ///////////////////////////////////////////////////////////////////////
    // Public API
    ///////////////////////////////////////////////////////////////////////
     */
    
    
Timeout we define for connecting to service: same for all operations, since it should be less prone for per-operation changes than read timeouts.
    public long getConnectTimeoutMsecs() { return ; }
    public long getPutCallTimeoutMsecs() { return ; }
    public long getGetCallTimeoutMsecs() { return ; }
    public long getDeleteCallTimeoutMsecs() { return ; }
    public int getMaxExcerptLength() {
        return ;
    }
    
    // NOTE: not configurable currently, can change should this change
    public long getMinimumTimeoutMsecs() {
        return ;
    }
New to GrepCode? Check out our FAQ X