Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.clustermate.service.servlet;
  
  
  
  
 
 @SuppressWarnings("serial")
 public class StoreListServlet<K extends EntryKey,
     E extends StoredEntry<K>
 >
     extends ServletWithMetricsBase
 {
     /*
     /**********************************************************************
     /* Helper objects
     /**********************************************************************
      */
 
     protected final StoreHandler<K,E,?> _storeHandler;
 
     protected final EntryKeyConverter<K> _keyConverter;
 
     /*
     /**********************************************************************
     /* Metrics info
     /**********************************************************************
      */
 
     protected final OperationMetrics _listMetrics;
     
     /*
     /**********************************************************************
     /* Life-cycle
     /**********************************************************************
      */
 
     public StoreListServlet(SharedServiceStuff stuffClusterViewByServer clusterView,
             StoreHandler<K,E,?> storeHandler)
     {
         // null -> use servlet path base as-is
         super(stuffclusterViewnull);
          = storeHandler;
          = stuff.getKeyConverter();
 
         final ServiceConfig serviceConfig = stuff.getServiceConfig();
         if (serviceConfig.metricsEnabled) {
              = OperationMetrics.forListingOperation(serviceConfig"entryList");
         } else {
              = null;
         }
     }
 
     @Override
     public void fillOperationMetrics(AllOperationMetrics metrics) {
         metrics.LIST = ExternalOperationMetrics.create();
     }
     
     /*
     /**********************************************************************
     /* Default implementation for key handling
     /**********************************************************************
      */
 
     protected K _findKey(ServletServiceRequest requestServletServiceResponse response)
     {
         return .extractFromPath(request);
     }
     
     /*
     /**********************************************************************
     /* Delegated methods for more control
     /**********************************************************************
      */
 
     @Override
     public void handleGet(ServletServiceRequest requestServletServiceResponse response,
             OperationDiagnostics statsthrows IOException
     {
         final OperationMetrics metrics = ;
         Context timer = (metrics == null) ? null : metrics.start();
         try {
             K prefix = _findKey(requestresponse);
             if (prefix == null) {
                 super.handleGet(requestresponsestats);
                 return;
             }
            .listEntries(requestresponseprefixstats);
            _addStdHeaders(response);
            response.writeOut(null);
        } finally {
            if (metrics != null) {
                 metrics.finish(timerstats);
            }
        }
    }
New to GrepCode? Check out our FAQ X