Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.clustermate.service;
  
Helper class used for requesting and returning per-operation statistics so that caller can update metrics and diagnostic information
  
 public class OperationDiagnostics
 {
    
Timestamp when diagnostics entry was created
 
     protected final long _nanoStart;

    
Timestamp when content copy operation started (if any)
 
     protected long _contentCopyStart;

    
Timestamp when content copy operation ended (if it did)
 
     protected long _contentCopyEnd;
     
     protected Storable _entry;

    
Number of items included in response, for operations where this makes sense.
 
     protected int _itemCount;

    
Accumulated information on primary database read calls.
 
     protected TotalTime _dbReads;

    
Accumulated information on primary database write calls.
 
     protected TotalTime _dbWrites;
 
     protected TotalTime _lastAccessReads;
 
     protected TotalTime _lastAccessWrites;
     
     /*
     /**********************************************************************
     /* Construction, population
     /**********************************************************************
      */
 
     public OperationDiagnostics() {
         this(System.nanoTime());
     }
 
     public OperationDiagnostics(long nanoStart) {
          = nanoStart;
     }
     
     public OperationDiagnostics setEntry(Storable e) {
          = e;
         return this;
     }
 
     public OperationDiagnostics setItemCount(int count) {
          = count;
         return this;
     }
 
     public void addDbRead(long nanos) {
          = TotalTime.createOrAdd(nanos);
     }
 
     public void addDbWrite(long nanos) {
          = TotalTime.createOrAdd(nanos);
     }
 
     public void addLastAccessRead(long nanos) {
          = TotalTime.createOrAdd(nanos);
     }
 
     public void addLastAccessWrite(long nanos) {
          = TotalTime.createOrAdd(nanos);
     }

    
Method called when content copy (between request and storage, or storage and response) is being started.
 
     public void startContentCopy(long startNanos) {
          = startNanos;
     }

    
Method called when content copy (between request and storage, or storage and response) is being started.
    public void startContentCopy() {
        startContentCopy(System.nanoTime());
    }
    
    public void finishContentCopy() {
         = System.nanoTime();
    }
    
    /*
    /**********************************************************************
    /* Accessors
    /**********************************************************************
     */
    
    public Storable getEntry() { return ; }
    public int getItemCount() { return ; }
    
    
Accessor for number of nanoseconds spent since construction of this object
    public long getNanosSpent() {
        return System.nanoTime() - ;
    }
    public long getContentCopyNanos()
    {
        final long start = ;
        if (start == 0L) {
            return 0L;
        }
        long end = ;
        if (end == 0L) {
            end = System.nanoTime();
        }
        return (end - start);
    }
    
    public boolean hasDbReads() { return  != null; }
    public boolean hasDbWrites() { return  != null; }
    public boolean hasLastAccessReads() { return  != null; }
    public boolean hasLastAccessWrites() { return  != null; }
    public boolean hasContentCopyNanos() {
        return ( != 0L);
    }
    public TotalTime getDbReads() { return ; }
    public TotalTime getDbWrites() { return ; }
    public TotalTime getLastAccessReads() { return ; }
    public TotalTime getLastAccessWrites() { return ; }
New to GrepCode? Check out our FAQ X