@Test public void badResponseHandlerAndRestRequestTest() throws Exception { responseHandler.shutdown(); for (String methodName : new String[]{"handleGet", "handlePost", "handleHead", "handleDelete", "handleOptions", "handlePut"}) { Method method = FrontendRestRequestService.class.getDeclaredMethod(methodName, RestRequest.class, RestResponseChannel.class); responseHandler.reset(); RestRequest restRequest = new BadRestRequest(); MockRestResponseChannel restResponseChannel = new MockRestResponseChannel(); method.invoke(frontendRestRequestService, restRequest, restResponseChannel); Exception e = restResponseChannel.getException(); assertTrue("Unexpected exception", e instanceof IllegalStateException || e instanceof NullPointerException); } }
@Override public void shutdown() { long shutdownBeginTime = System.currentTimeMillis(); isUp = false; try { if (securityService != null) { securityService.close(); securityService = null; } if (idConverter != null) { idConverter.close(); idConverter = null; } logger.info("FrontendRestRequestService shutdown complete"); } catch (IOException e) { logger.error("Downstream service close failed", e); } finally { frontendMetrics.restRequestServiceShutdownTimeInMs.update(System.currentTimeMillis() - shutdownBeginTime); } }
FrontendRestRequestService implements RestRequestService { @Override public void shutdown() { long shutdownBeginTime = System.currentTimeMillis(); isUp = false; try { if (securityService != null) { securityService.close(); securityService = null; } if (idConverter != null) { idConverter.close(); idConverter = null; } logger.info("FrontendRestRequestService shutdown complete"); } catch (IOException e) { logger.error("Downstream service close failed", e); } finally { frontendMetrics.restRequestServiceShutdownTimeInMs.update(System.currentTimeMillis() - shutdownBeginTime); } } }
FrontendRestRequestService implements RestRequestService { @Override public void shutdown() { long shutdownBeginTime = System.currentTimeMillis(); isUp = false; try { if (securityService != null) { securityService.close(); securityService = null; } if (idConverter != null) { idConverter.close(); idConverter = null; } logger.info("FrontendRestRequestService shutdown complete"); } catch (IOException e) { logger.error("Downstream service close failed", e); } finally { frontendMetrics.restRequestServiceShutdownTimeInMs.update(System.currentTimeMillis() - shutdownBeginTime); } } FrontendRestRequestService(FrontendConfig frontendConfig, FrontendMetrics frontendMetrics, Router router,
      ClusterMap clusterMap, IdConverterFactory idConverterFactory, SecurityServiceFactory securityServiceFactory,
      UrlSigningService urlSigningService, IdSigningService idSigningService, AccountService accountService,
      AccountAndContainerInjector accountAndContainerInjector, String datacenterName, String hostname,
      String clusterName); }
FrontendRestRequestService implements RestRequestService { @Override public void shutdown() { long shutdownBeginTime = System.currentTimeMillis(); isUp = false; try { if (securityService != null) { securityService.close(); securityService = null; } if (idConverter != null) { idConverter.close(); idConverter = null; } logger.info("FrontendRestRequestService shutdown complete"); } catch (IOException e) { logger.error("Downstream service close failed", e); } finally { frontendMetrics.restRequestServiceShutdownTimeInMs.update(System.currentTimeMillis() - shutdownBeginTime); } } FrontendRestRequestService(FrontendConfig frontendConfig, FrontendMetrics frontendMetrics, Router router,
      ClusterMap clusterMap, IdConverterFactory idConverterFactory, SecurityServiceFactory securityServiceFactory,
      UrlSigningService urlSigningService, IdSigningService idSigningService, AccountService accountService,
      AccountAndContainerInjector accountAndContainerInjector, String datacenterName, String hostname,
      String clusterName); @Override void setupResponseHandler(RestResponseHandler responseHandler); @Override void start(); @Override void shutdown(); @Override void handleGet(final RestRequest restRequest, final RestResponseChannel restResponseChannel); @Override void handlePost(RestRequest restRequest, RestResponseChannel restResponseChannel); @Override void handlePut(RestRequest restRequest, RestResponseChannel restResponseChannel); @Override void handleDelete(RestRequest restRequest, RestResponseChannel restResponseChannel); @Override void handleHead(RestRequest restRequest, RestResponseChannel restResponseChannel); @Override void handleOptions(RestRequest restRequest, RestResponseChannel restResponseChannel); }
FrontendRestRequestService implements RestRequestService { @Override public void shutdown() { long shutdownBeginTime = System.currentTimeMillis(); isUp = false; try { if (securityService != null) { securityService.close(); securityService = null; } if (idConverter != null) { idConverter.close(); idConverter = null; } logger.info("FrontendRestRequestService shutdown complete"); } catch (IOException e) { logger.error("Downstream service close failed", e); } finally { frontendMetrics.restRequestServiceShutdownTimeInMs.update(System.currentTimeMillis() - shutdownBeginTime); } } FrontendRestRequestService(FrontendConfig frontendConfig, FrontendMetrics frontendMetrics, Router router,
      ClusterMap clusterMap, IdConverterFactory idConverterFactory, SecurityServiceFactory securityServiceFactory,
      UrlSigningService urlSigningService, IdSigningService idSigningService, AccountService accountService,
      AccountAndContainerInjector accountAndContainerInjector, String datacenterName, String hostname,
      String clusterName); @Override void setupResponseHandler(RestResponseHandler responseHandler); @Override void start(); @Override void shutdown(); @Override void handleGet(final RestRequest restRequest, final RestResponseChannel restResponseChannel); @Override void handlePost(RestRequest restRequest, RestResponseChannel restResponseChannel); @Override void handlePut(RestRequest restRequest, RestResponseChannel restResponseChannel); @Override void handleDelete(RestRequest restRequest, RestResponseChannel restResponseChannel); @Override void handleHead(RestRequest restRequest, RestResponseChannel restResponseChannel); @Override void handleOptions(RestRequest restRequest, RestResponseChannel restResponseChannel);  }