Source:
<code>MultiThreadedClientServiceCache(MultiThreadedServiceFactory<S> serviceFactory, ScheduledExecutorService executor, int evictionDelayInSeconds, int cleanUpDelayInSeconds, MetricRegistry metricRegistry) { checkNotNull(serviceFactory); checkNotNull(metricRegistry); checkArgument(evictionDelayInSeconds >= 0); checkArgument(cleanUpDelayInSeconds >= 0); _serviceFactory = serviceFactory; _cleanupExecutor = executor; _evictionDelayInSeconds = evictionDelayInSeconds; _isClosed = false; _metrics = Metrics.forInstance(metricRegistry, this, serviceFactory.getServiceName()); _registerTimer = _metrics.timer("register-time"); _evictionTimer = _metrics.timer("eviction-time"); _serviceCounter = _metrics.counter("service-counter"); _cleanupFuture = _cleanupExecutor.scheduleAtFixedRate( new Runnable() { @Override public void run() { List<HeavyServiceHandle<S>> handlesToDelete = new LinkedList<>(); synchronized (MultiThreadedClientServiceCache.this) { Map<ServiceEndPoint, HeavyServiceHandle<S>> sourceCopy = Maps.newHashMap(_instancesPerEndpoint); for (Map.Entry<ServiceEndPoint, HeavyServiceHandle<S>> entry : _instancesPerEndpoint.entrySet()) { HeavyServiceHandle handle = entry.getValue(); if ( handle.timeToEvict() ) { handlesToDelete.add( sourceCopy.remove( handle.getEndPoint() ) ); } } _instancesPerEndpoint = sourceCopy; } for ( HeavyServiceHandle<S> handle : handlesToDelete ) { destroyService(handle); } _serviceCounter.dec(handlesToDelete.size()); } }, <START> (cleanUpDelayInSeconds * 1000) + 1, <END> (cleanUpDelayInSeconds * 1000) + 1, TimeUnit.MILLISECONDS); }</code><technical_language>constructor accept milliseconds change defaults in millis, do conversion in other constructor calls this one</technical_language>

Target:
MultiThreadedClientServiceCache(MultiThreadedServiceFactory<S> serviceFactory, ScheduledExecutorService executor, int evictionDelayInSeconds, int cleanUpDelayInSeconds, MetricRegistry metricRegistry) { checkNotNull(serviceFactory); checkNotNull(metricRegistry); checkArgument(evictionDelayInSeconds >= 0); checkArgument(cleanUpDelayInSeconds >= 0); _serviceFactory = serviceFactory; _cleanupExecutor = executor; _evictionDelayInMilliSeconds = SECONDS.toMillis(evictionDelayInSeconds); _isClosed = false; _metrics = Metrics.forInstance(metricRegistry, this, serviceFactory.getServiceName()); _registerTimer = _metrics.timer("register-time"); _evictionTimer = _metrics.timer("eviction-time"); _serviceCounter = _metrics.counter("service-counter"); _cleanupFuture = _cleanupExecutor.scheduleAtFixedRate( new Runnable() { @Override public void run() { List<HeavyServiceHandle<S>> handlesToDelete = new LinkedList<>(); synchronized (MultiThreadedClientServiceCache.this) { Map<ServiceEndPoint, HeavyServiceHandle<S>> sourceCopy = Maps.newHashMap(_instancesPerEndpoint); for (HeavyServiceHandle<S> handle : _instancesPerEndpoint.values()) { if (handle.timeToEvict()) { handlesToDelete.add(sourceCopy.remove(handle.getEndPoint())); } } _instancesPerEndpoint = sourceCopy; } for (HeavyServiceHandle<S> handle : handlesToDelete) { destroyService(handle); } _serviceCounter.dec(handlesToDelete.size()); } }, SECONDS.toMillis(cleanUpDelayInSeconds) + 1, SECONDS.toMillis(cleanUpDelayInSeconds) + 1, TimeUnit.MILLISECONDS); }