@Test public void testGetDelegate() { Extractor d1 = reloader.getOrReload(); assertSame(mockExtractor1, d1); Extractor d2 = reloader.getOrReload(); assertSame(mockExtractor1, d2); when(mockModel.getLoadedOn()).thenReturn(System.currentTimeMillis() + 1); Extractor d3 = reloader.getOrReload(); assertSame(mockExtractor2, d3); }
Extractor getOrReload() { ExtractorModel model = extractorModelService.get(name); if (needsReload(model)) { synchronized (this) { if (needsReload(model)) { this.lastSeen = model.getLoadedOn() + 1; this.delegate = createExtractor(model); } } } return delegate; }
ExtractorReloader { Extractor getOrReload() { ExtractorModel model = extractorModelService.get(name); if (needsReload(model)) { synchronized (this) { if (needsReload(model)) { this.lastSeen = model.getLoadedOn() + 1; this.delegate = createExtractor(model); } } } return delegate; } }
ExtractorReloader { Extractor getOrReload() { ExtractorModel model = extractorModelService.get(name); if (needsReload(model)) { synchronized (this) { if (needsReload(model)) { this.lastSeen = model.getLoadedOn() + 1; this.delegate = createExtractor(model); } } } return delegate; } ExtractorReloader(
            IExtractorModelService extractorModelService,
            IConnectorService connectorService,
            Map<String, IExtractorFactory> factories,
            ExtractorName name); }
ExtractorReloader { Extractor getOrReload() { ExtractorModel model = extractorModelService.get(name); if (needsReload(model)) { synchronized (this) { if (needsReload(model)) { this.lastSeen = model.getLoadedOn() + 1; this.delegate = createExtractor(model); } } } return delegate; } ExtractorReloader(
            IExtractorModelService extractorModelService,
            IConnectorService connectorService,
            Map<String, IExtractorFactory> factories,
            ExtractorName name);  }
ExtractorReloader { Extractor getOrReload() { ExtractorModel model = extractorModelService.get(name); if (needsReload(model)) { synchronized (this) { if (needsReload(model)) { this.lastSeen = model.getLoadedOn() + 1; this.delegate = createExtractor(model); } } } return delegate; } ExtractorReloader(
            IExtractorModelService extractorModelService,
            IConnectorService connectorService,
            Map<String, IExtractorFactory> factories,
            ExtractorName name);   }