@Test public void testMultipleClose() { MultiThreadedClientServiceCache<Service> cache = newCache(); cache.close(); cache.close(); }
@Override public synchronized void close() { _isClosed = true; for (ServiceHandle<S> serviceHandle : _instancesPerEndpoint.values()) { _serviceFactory.destroy(serviceHandle.getEndPoint(), serviceHandle.getService()); } _instancesPerEndpoint = Maps.newHashMap(); _cleanupFuture.cancel(false); _cleanupExecutor.shutdownNow(); _metrics.close(); }
MultiThreadedClientServiceCache implements ServiceCache<S> { @Override public synchronized void close() { _isClosed = true; for (ServiceHandle<S> serviceHandle : _instancesPerEndpoint.values()) { _serviceFactory.destroy(serviceHandle.getEndPoint(), serviceHandle.getService()); } _instancesPerEndpoint = Maps.newHashMap(); _cleanupFuture.cancel(false); _cleanupExecutor.shutdownNow(); _metrics.close(); } }
MultiThreadedClientServiceCache implements ServiceCache<S> { @Override public synchronized void close() { _isClosed = true; for (ServiceHandle<S> serviceHandle : _instancesPerEndpoint.values()) { _serviceFactory.destroy(serviceHandle.getEndPoint(), serviceHandle.getService()); } _instancesPerEndpoint = Maps.newHashMap(); _cleanupFuture.cancel(false); _cleanupExecutor.shutdownNow(); _metrics.close(); } MultiThreadedClientServiceCache(MultiThreadedServiceFactory<S> serviceFactory, MetricRegistry metricRegistry); @VisibleForTesting  MultiThreadedClientServiceCache(MultiThreadedServiceFactory<S> serviceFactory, ScheduledExecutorService executor,
                                    int evictionDelayInSeconds, int cleanUpDelayInSeconds, MetricRegistry metricRegistry); }
MultiThreadedClientServiceCache implements ServiceCache<S> { @Override public synchronized void close() { _isClosed = true; for (ServiceHandle<S> serviceHandle : _instancesPerEndpoint.values()) { _serviceFactory.destroy(serviceHandle.getEndPoint(), serviceHandle.getService()); } _instancesPerEndpoint = Maps.newHashMap(); _cleanupFuture.cancel(false); _cleanupExecutor.shutdownNow(); _metrics.close(); } MultiThreadedClientServiceCache(MultiThreadedServiceFactory<S> serviceFactory, MetricRegistry metricRegistry); @VisibleForTesting  MultiThreadedClientServiceCache(MultiThreadedServiceFactory<S> serviceFactory, ScheduledExecutorService executor,
                                    int evictionDelayInSeconds, int cleanUpDelayInSeconds, MetricRegistry metricRegistry); @Override void checkIn(ServiceHandle<S> handle); @Override ServiceHandle<S> checkOut(ServiceEndPoint endPoint); @Override void register(ServiceEndPoint endPoint); @Override synchronized void evict(ServiceEndPoint endPoint); @Override synchronized void close(); @Override int getNumIdleInstances(ServiceEndPoint endPoint); @Override int getNumActiveInstances(ServiceEndPoint endPoint); }
MultiThreadedClientServiceCache implements ServiceCache<S> { @Override public synchronized void close() { _isClosed = true; for (ServiceHandle<S> serviceHandle : _instancesPerEndpoint.values()) { _serviceFactory.destroy(serviceHandle.getEndPoint(), serviceHandle.getService()); } _instancesPerEndpoint = Maps.newHashMap(); _cleanupFuture.cancel(false); _cleanupExecutor.shutdownNow(); _metrics.close(); } MultiThreadedClientServiceCache(MultiThreadedServiceFactory<S> serviceFactory, MetricRegistry metricRegistry); @VisibleForTesting  MultiThreadedClientServiceCache(MultiThreadedServiceFactory<S> serviceFactory, ScheduledExecutorService executor,
                                    int evictionDelayInSeconds, int cleanUpDelayInSeconds, MetricRegistry metricRegistry); @Override void checkIn(ServiceHandle<S> handle); @Override ServiceHandle<S> checkOut(ServiceEndPoint endPoint); @Override void register(ServiceEndPoint endPoint); @Override synchronized void evict(ServiceEndPoint endPoint); @Override synchronized void close(); @Override int getNumIdleInstances(ServiceEndPoint endPoint); @Override int getNumActiveInstances(ServiceEndPoint endPoint);  }