List of usage examples for java.util.concurrent.atomic AtomicReference AtomicReference
public AtomicReference(V initialValue)
From source file:net.centro.rtb.monitoringcenter.metrics.system.os.OperatingSystemMetricSet.java
public OperatingSystemMetricSet() { this.operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean(); this.rootFilePath = new File("/"); // Set up iowait retrieval job if needed Double ioWaitPercentage = fetchIoWaitPercentage(); if (ioWaitPercentage != null) { this.ioWaitPercentageHolder = new AtomicReference<>(ioWaitPercentage); this.executorService = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat("OperatingSystemMetricSet-%d").build()); this.executorService.scheduleWithFixedDelay(new Runnable() { @Override//from w ww. ja v a2 s .com public void run() { Double ioWaitPercentage = fetchIoWaitPercentage(); if (ioWaitPercentage != null) { ioWaitPercentageHolder.set(ioWaitPercentage); } } }, 5, 5, TimeUnit.SECONDS); } // ----- Init and assign metrics ----- this.metricsByNames = new HashMap<>(); // Available everywhere this.availableLogicalProcessorsGauge = new Gauge<Integer>() { @Override public Integer getValue() { return operatingSystemMXBean.getAvailableProcessors(); } }; metricsByNames.put("availableLogicalProcessors", availableLogicalProcessorsGauge); if (operatingSystemMXBean.getSystemLoadAverage() >= 0) { // Where available this.systemLoadAverageGauge = new Gauge<Double>() { @Override public Double getValue() { return operatingSystemMXBean.getSystemLoadAverage(); } }; metricsByNames.put("systemLoadAverage", systemLoadAverageGauge); this.systemLoadAveragePerLogicalProcessorGauge = new Gauge<Double>() { @Override public Double getValue() { return operatingSystemMXBean.getSystemLoadAverage() / operatingSystemMXBean.getAvailableProcessors(); } }; metricsByNames.put("systemLoadAveragePerLogicalProcessor", systemLoadAveragePerLogicalProcessorGauge); } // Sun JVMs, incl. OpenJDK if (com.sun.management.OperatingSystemMXBean.class.isAssignableFrom(operatingSystemMXBean.getClass())) { final com.sun.management.OperatingSystemMXBean sunOsMxBean = com.sun.management.OperatingSystemMXBean.class .cast(operatingSystemMXBean); if (sunOsMxBean.getProcessCpuLoad() >= 0) { this.jvmCpuBusyPercentageGauge = new Gauge<Double>() { @Override public Double getValue() { return sunOsMxBean.getProcessCpuLoad() * 100; } }; metricsByNames.put("jvmCpuBusyPercentage", jvmCpuBusyPercentageGauge); } if (sunOsMxBean.getSystemCpuLoad() >= 0) { this.systemCpuBusyPercentageGauge = new Gauge<Double>() { @Override public Double getValue() { return sunOsMxBean.getSystemCpuLoad() * 100; } }; metricsByNames.put("systemCpuBusyPercentage", systemCpuBusyPercentageGauge); } if (sunOsMxBean.getCommittedVirtualMemorySize() >= 0) { this.committedVirtualMemorySizeInBytesGauge = new Gauge<Long>() { @Override public Long getValue() { return sunOsMxBean.getCommittedVirtualMemorySize(); } }; metricsByNames.put("committedVirtualMemorySizeInBytes", committedVirtualMemorySizeInBytesGauge); } // Physical Memory String physicalMemoryNamespace = "physicalMemory"; this.totalPhysicalMemorySizeInBytesGauge = new Gauge<Long>() { @Override public Long getValue() { return sunOsMxBean.getTotalPhysicalMemorySize(); } }; metricsByNames.put(MetricNamingUtil.join(physicalMemoryNamespace, "totalInBytes"), totalPhysicalMemorySizeInBytesGauge); this.freePhysicalMemorySizeInBytesGauge = new Gauge<Long>() { @Override public Long getValue() { return sunOsMxBean.getFreePhysicalMemorySize(); } }; metricsByNames.put(MetricNamingUtil.join(physicalMemoryNamespace, "freeInBytes"), freePhysicalMemorySizeInBytesGauge); this.usedPhysicalMemoryPercentageGauge = new Gauge<Double>() { @Override public Double getValue() { long totalPhysicalMemorySize = sunOsMxBean.getTotalPhysicalMemorySize(); if (totalPhysicalMemorySize == 0) { return 0.0; } long usedPhysicalMemorySize = totalPhysicalMemorySize - sunOsMxBean.getFreePhysicalMemorySize(); return Double.valueOf(usedPhysicalMemorySize) / totalPhysicalMemorySize * 100; } }; metricsByNames.put(MetricNamingUtil.join(physicalMemoryNamespace, "usedPercentage"), usedPhysicalMemoryPercentageGauge); // Swap Space String swapSpaceNamespace = "swapSpace"; this.totalSwapSpaceSizeInBytesGauge = new Gauge<Long>() { @Override public Long getValue() { return sunOsMxBean.getTotalSwapSpaceSize(); } }; metricsByNames.put(MetricNamingUtil.join(swapSpaceNamespace, "totalInBytes"), totalSwapSpaceSizeInBytesGauge); this.freeSwapSpaceSizeInBytesGauge = new Gauge<Long>() { @Override public Long getValue() { return sunOsMxBean.getFreeSwapSpaceSize(); } }; metricsByNames.put(MetricNamingUtil.join(swapSpaceNamespace, "freeInBytes"), freeSwapSpaceSizeInBytesGauge); this.usedSwapSpacePercentageGauge = new Gauge<Double>() { @Override public Double getValue() { long totalSwapSpaceSize = sunOsMxBean.getTotalSwapSpaceSize(); if (totalSwapSpaceSize == 0) { return 0.0; } long usedSwapSpaceSize = totalSwapSpaceSize - sunOsMxBean.getFreeSwapSpaceSize(); return Double.valueOf(usedSwapSpaceSize) / totalSwapSpaceSize * 100; } }; metricsByNames.put(MetricNamingUtil.join(swapSpaceNamespace, "usedPercentage"), usedSwapSpacePercentageGauge); } // File descriptors (e.g., sockets) String fileDescriptorsNamespace = "fileDescriptors"; if (UnixOperatingSystemMXBean.class.isAssignableFrom(operatingSystemMXBean.getClass())) { final UnixOperatingSystemMXBean unixOsMxBean = UnixOperatingSystemMXBean.class .cast(operatingSystemMXBean); this.maxFileDescriptorsGauge = new Gauge<Long>() { @Override public Long getValue() { return unixOsMxBean.getMaxFileDescriptorCount(); } }; metricsByNames.put(MetricNamingUtil.join(fileDescriptorsNamespace, "max"), maxFileDescriptorsGauge); this.openFileDescriptorsGauge = new Gauge<Long>() { @Override public Long getValue() { return unixOsMxBean.getOpenFileDescriptorCount(); } }; metricsByNames.put(MetricNamingUtil.join(fileDescriptorsNamespace, "open"), openFileDescriptorsGauge); this.usedFileDescriptorsPercentageGauge = new Gauge<Double>() { @Override public Double getValue() { long maxFileDescriptors = unixOsMxBean.getMaxFileDescriptorCount(); if (maxFileDescriptors == 0) { return 0.0; } return Double.valueOf(unixOsMxBean.getOpenFileDescriptorCount()) / maxFileDescriptors * 100; } }; metricsByNames.put(MetricNamingUtil.join(fileDescriptorsNamespace, "usedPercentage"), usedFileDescriptorsPercentageGauge); } // Disk space String diskSpaceNamespace = "diskSpace"; if (rootFilePath.getTotalSpace() > 0) { this.totalDiskSpaceInBytesGauge = new Gauge<Long>() { @Override public Long getValue() { return rootFilePath.getTotalSpace(); } }; metricsByNames.put(MetricNamingUtil.join(diskSpaceNamespace, "totalInBytes"), totalDiskSpaceInBytesGauge); this.freeDiskSpaceInBytesGauge = new Gauge<Long>() { @Override public Long getValue() { return rootFilePath.getFreeSpace(); } }; metricsByNames.put(MetricNamingUtil.join(diskSpaceNamespace, "freeInBytes"), freeDiskSpaceInBytesGauge); this.usedDiskSpacePercentageGauge = new Gauge<Double>() { @Override public Double getValue() { long totalDiskSpace = rootFilePath.getTotalSpace(); if (totalDiskSpace == 0) { return 0.0; } long usedDiskSpace = totalDiskSpace - rootFilePath.getFreeSpace(); return Double.valueOf(usedDiskSpace) / totalDiskSpace * 100; } }; metricsByNames.put(MetricNamingUtil.join(diskSpaceNamespace, "usedPercentage"), usedDiskSpacePercentageGauge); } // CPU IO Wait if (ioWaitPercentageHolder != null) { this.ioWaitPercentageGauge = new Gauge<Double>() { @Override public Double getValue() { return ioWaitPercentageHolder.get(); } }; metricsByNames.put("ioWaitPercentage", ioWaitPercentageGauge); } this.shutdown = new AtomicBoolean(false); }
From source file:com.nesscomputing.httpserver.jetty.TestClasspathResourceHandler.java
@Test public void testIfModified() throws Exception { final AtomicReference<String> holder = new AtomicReference<String>(null); final HttpClientResponseHandler<String> responseHandler = new ContentResponseHandler<String>( new StringContentConverter() { @Override/* w w w .j a v a 2 s .c o m*/ public String convert(final HttpClientResponse response, final InputStream inputStream) throws IOException { holder.set(response.getHeader("Last-Modified")); return super.convert(response, inputStream); } }); final String uri = baseUri + "/simple-content.txt"; final String content = httpClient.get(uri, responseHandler).perform(); Assert.assertNotNull(holder.get()); Assert.assertEquals("this is simple content for a simple test\n", content); final HttpClientResponseHandler<String> responseHandler2 = new ContentResponseHandler<String>( new StringContentConverter() { @Override public String convert(final HttpClientResponse response, final InputStream inputStream) throws IOException { Assert.assertEquals(304, response.getStatusCode()); return null; } }); final String content2 = httpClient.get(uri, responseHandler2).addHeader("If-Modified-Since", holder.get()) .perform(); Assert.assertNull(content2); // "Time zone names ('z') cannot be parsed." so we hack it by hand, assuming GMT >:( final DateTimeFormatter httpFormat = DateTimeFormat.forPattern("EEE, dd MMM YYYY HH:mm:ss"); final long newModified = httpFormat.parseMillis(StringUtils.removeEnd(holder.get(), " GMT")) - 600000; httpClient.get(uri, Valid2xxContentConverter.DEFAULT_FAILING_RESPONSE_HANDLER) .addHeader("If-Modified-Since", httpFormat.print(newModified) + " GMT").perform(); }
From source file:com.comcast.viper.flume2storm.connection.receptor.KryoNetEventReceptor.java
/** * @param connectionParams/* w w w . jav a 2 s .co m*/ * Connection parameters to the {@link KryoNetEventSender} * @param kryoNetParams * Generic parameters of the {@link KryoNetEventReceptor} */ public KryoNetEventReceptor(final KryoNetConnectionParameters connectionParams, KryoNetParameters kryoNetParams) { Preconditions.checkNotNull(connectionParams); this.kryoNetParameters = kryoNetParams; this.connectionParams = connectionParams; stats = new EventReceptorStats(connectionParams.getId()); listeners = new AtomicReference<>(ImmutableList.copyOf(new ArrayList<EventReceptorListener>())); events = new ConcurrentLinkedQueue<F2SEvent>(); keepRunning = new AtomicBoolean(false); nextConnectionTime = new AtomicReference<Instant>(new Instant(0)); }
From source file:com.machinepublishers.jbrowserdriver.Context.java
void init(final JBrowserDriverServer driver) { synchronized (lock) { if (!items.isEmpty()) { items.get(current).init(driver, this); }/*from www . j ava 2 s . c o m*/ if (initialized.compareAndSet(false, true)) { robot.set(new Robot(this)); try { targetLocator.set(new TargetLocatorServer(driver, this)); keyboard.set(new KeyboardServer(robot)); mouse.set(new MouseServer(robot)); navigation.set(new NavigationServer(new AtomicReference<JBrowserDriverServer>(driver), this)); options.set(new OptionsServer(this, timeouts)); } catch (RemoteException e) { Util.handleException(e); } } } }
From source file:com.xylocore.cassandra.query.SharedResultSetProcessor.java
/** * FILLIN/* w w w. j ava2s . c o m*/ * * @param aExecutionContext * @param aExecutor * @param aCompletionNotifier */ SharedResultSetProcessor(PagedQueryExecutionContext<T> aExecutionContext, Executor aExecutor, ResultSetCompletionNotifier<T> aCompletionNotifier) { Validate.notNull(aExecutionContext); Validate.notNull(aCompletionNotifier); executionContext = aExecutionContext; executor = aExecutor; completionNotifier = aCompletionNotifier; availableTasks = new ConcurrentLinkedQueue<>(); availableTaskCount = new AtomicInteger(aExecutionContext.getConcurrencyLevel()); state = new AtomicReference<>(State.Inactive); workTasksLocked = new AtomicBoolean(false); fetchFuture = null; completed = false; resultSet = null; currentWorkTask = null; for (int i = 0, ci = aExecutionContext.getConcurrencyLevel(); i < ci; i++) { WorkTask myWorkTask = new WorkTask(i); availableTasks.offer(myWorkTask); } }
From source file:com.microsoft.tfs.core.TFSTeamProjectCollection.java
/** * The most complete way of creating a {@link TFSTeamProjectCollection}. A * {@link URI}, {@link Credentials} and a {@link ConnectionAdvisor} are * specified./* ww w . jav a2 s .c o m*/ * * @param serverURI * the {@link URI} to connect to (must not be <code>null</code>) * @param credentials * the {@link Credentials} to connect with (or <code>null</code> to * attempt to use the best available credentials) * @param advisor * the {@link ConnectionAdvisor} to use (must not be * <code>null</code>) */ public TFSTeamProjectCollection(final URI serverURI, final Credentials credentials, final ConnectionAdvisor advisor) { this(serverURI, new AtomicReference<Credentials>(credentials), advisor); }
From source file:io.galeb.router.tests.handlers.PathGlobHandlerTest.java
@Test public void checkMatch() { final AtomicReference<String> result = new AtomicReference<>("default"); HttpHandler defaultHandler = mock(HttpHandler.class); PathGlobHandler pathGlobHandler = new PathGlobHandler(); pathGlobHandler.setDefaultHandler(defaultHandler); pathGlobHandler.addPath("/x", 0, exchange -> result.set("x")); pathGlobHandler.addPath("/y", 0, exchange -> result.set("y")); pathGlobHandler.addPath("/z", 0, exchange -> result.set("z")); pathGlobHandler.addPath("/w", 0, exchange -> result.set("w")); pathGlobHandler.addPath("/1", 1, exchange -> result.set("1")); pathGlobHandler.addPath("/2", 2, exchange -> result.set("2")); pathGlobHandler.addPath("/3", 3, exchange -> result.set("3")); pathGlobHandler.addPath("/4", 4, exchange -> result.set("4")); pathGlobHandler.addPath("/5*", 4, exchange -> result.set("5")); pathGlobHandler.addPath("/6/*", Integer.MAX_VALUE - 1, exchange -> result.set("6")); pathGlobHandler.addPath("/7/*.json", Integer.MAX_VALUE - 1, exchange -> result.set("7")); pathGlobHandler.addPath("/", Integer.MAX_VALUE, exchange -> result.set("slash")); ServerConnection serverConnection = mock(ServerConnection.class); try {//ww w . j ava 2 s . c om HttpServerExchange exchangeNotMatch = new HttpServerExchange(serverConnection); exchangeNotMatch.setRelativePath(UUID.randomUUID().toString()); HttpServerExchange exchangeX = new HttpServerExchange(serverConnection); exchangeX.setRelativePath("/x"); HttpServerExchange exchangeY = new HttpServerExchange(serverConnection); exchangeY.setRelativePath("/y"); HttpServerExchange exchangeZ = new HttpServerExchange(serverConnection); exchangeZ.setRelativePath("/z"); HttpServerExchange exchangeW = new HttpServerExchange(serverConnection); exchangeW.setRelativePath("/w"); HttpServerExchange exchange1 = new HttpServerExchange(serverConnection); exchange1.setRelativePath("/1"); HttpServerExchange exchange2 = new HttpServerExchange(serverConnection); exchange2.setRelativePath("/2"); HttpServerExchange exchange3 = new HttpServerExchange(serverConnection); exchange3.setRelativePath("/3"); HttpServerExchange exchange4 = new HttpServerExchange(serverConnection); exchange4.setRelativePath("/4"); HttpServerExchange exchange5 = new HttpServerExchange(serverConnection); exchange5.setRelativePath("/555"); HttpServerExchange exchange6 = new HttpServerExchange(serverConnection); exchange6.setRelativePath("/6/xpto"); HttpServerExchange exchange7 = new HttpServerExchange(serverConnection); exchange7.setRelativePath("/7/xpto/test.json"); HttpServerExchange exchangeSlash = new HttpServerExchange(serverConnection); exchangeSlash.setRelativePath("/"); pathGlobHandler.handleRequest(exchangeNotMatch); assertThat(result.get(), equalTo("default")); pathGlobHandler.handleRequest(exchangeX); assertThat(result.get(), equalTo("x")); pathGlobHandler.handleRequest(exchangeY); assertThat(result.get(), equalTo("y")); pathGlobHandler.handleRequest(exchangeZ); assertThat(result.get(), equalTo("z")); pathGlobHandler.handleRequest(exchangeW); assertThat(result.get(), equalTo("w")); pathGlobHandler.handleRequest(exchange1); assertThat(result.get(), equalTo("1")); pathGlobHandler.handleRequest(exchange2); assertThat(result.get(), equalTo("2")); pathGlobHandler.handleRequest(exchange3); assertThat(result.get(), equalTo("3")); pathGlobHandler.handleRequest(exchange4); assertThat(result.get(), equalTo("4")); pathGlobHandler.handleRequest(exchange2); assertThat(result.get(), equalTo("2")); pathGlobHandler.handleRequest(exchange1); assertThat(result.get(), equalTo("1")); pathGlobHandler.handleRequest(exchange5); assertThat(result.get(), equalTo("5")); pathGlobHandler.handleRequest(exchange6); assertThat(result.get(), equalTo("6")); pathGlobHandler.handleRequest(exchange7); assertThat(result.get(), equalTo("7")); pathGlobHandler.handleRequest(exchangeSlash); assertThat(result.get(), equalTo("slash")); } catch (Exception e) { logger.error(ExceptionUtils.getStackTrace(e)); } catch (AssertionError assertionError) { pathGlobHandler.getPaths().forEach((k, v) -> logger.error(k.getPath() + " -> " + k.getOrder())); throw assertionError; } }
From source file:com.ryan.ryanreader.fragments.MainMenuFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { // TODO load menu position? final Context context; // //from w ww . j av a2 s . c om if (container != null) { context = container.getContext(); // TODO just use the inflater's // context in every case? } else { context = inflater.getContext(); } // final RedditAccount user = RedditAccountManager.getInstance(context).getDefaultAccount(); final LinearLayout outer = new LinearLayout(context); // outer.setOrientation(LinearLayout.VERTICAL); notifications = new LinearLayout(context); notifications.setOrientation(LinearLayout.VERTICAL); loadingView = new LoadingView(context, R.string.download_waiting, true, true); final ListView lv = new ListView(context); lv.setDivider(null); // listview? lv.addFooterView(notifications); final int paddingPx = General.dpToPixels(context, 8); lv.setPadding(paddingPx, 0, paddingPx, 0); adapter = new MainMenuAdapter(context, user, this); lv.setAdapter(adapter); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(final AdapterView<?> adapterView, final View view, final int position, final long id) { adapter.clickOn(position); } }); final AtomicReference<APIResponseHandler.SubredditResponseHandler> accessibleSubredditResponseHandler = new AtomicReference<APIResponseHandler.SubredditResponseHandler>( null); final APIResponseHandler.SubredditResponseHandler responseHandler = new APIResponseHandler.SubredditResponseHandler( context) { @Override protected void onDownloadNecessary() { new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { notifications.addView(loadingView); } }); } @Override protected void onDownloadStarted() { loadingView.setIndeterminate(R.string.download_subreddits); } @Override protected void onSuccess(final List<RedditSubreddit> result, final long timestamp) { if (result.size() == 0) { // Just get the defaults instead new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { notifications.removeView(loadingView); RedditAPI.getUserSubreddits(CacheManager.getInstance(context), accessibleSubredditResponseHandler.get(), RedditAccountManager.getAnon(), force ? CacheRequest.DownloadType.FORCE : CacheRequest.DownloadType.IF_NECESSARY, force, context); } }); } else { adapter.setSubreddits(result); if (loadingView != null) loadingView.setDone(R.string.download_done); } } @Override protected void onCallbackException(final Throwable t) { BugReportActivity.handleGlobalError(context, t); } @Override protected void onFailure(final RequestFailureType type, final Throwable t, final StatusLine status, final String readableMessage) { if (loadingView != null) loadingView.setDone(R.string.download_failed); final RRError error = General.getGeneralErrorForFailure(context, type, t, status); new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { notifications.addView(new ErrorView(getSupportActivity(), error)); } }); } @Override protected void onFailure(final APIFailureType type) { if (loadingView != null) loadingView.setDone(R.string.download_failed); final RRError error = General.getGeneralErrorForFailure(context, type); new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { notifications.addView(new ErrorView(getSupportActivity(), error)); } }); } }; accessibleSubredditResponseHandler.set(responseHandler); RedditAPI.getUserSubreddits(CacheManager.getInstance(context), responseHandler, user, force ? CacheRequest.DownloadType.FORCE : CacheRequest.DownloadType.IF_NECESSARY, force, context); outer.addView(lv); lv.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT; return outer; }
From source file:org.xwiki.contrib.repository.pypi.internal.PypiExtensionRepository.java
private void initializePackageListIndexDirectory() throws InitializationException { try {/*from www.j ava 2s . c o m*/ URL inputUrl = getClass().getResource("/luceneIndexOfValidPackages/index.zip"); File zipFile = new File( environment.getTemporaryDirectory().getAbsolutePath() + File.separator + "index.zip"); zipFile.createNewFile(); FileUtils.copyURLToFile(inputUrl, zipFile); File indexDir = environment.getTemporaryDirectory(); ZipUtils.unpack(zipFile, indexDir); FileUtils.forceDelete(zipFile); pypiPackageListIndexDirectory = new AtomicReference<>(indexDir); } catch (Exception e) { throw new InitializationException("Could not copy lucene index to local directory", e); } }
From source file:org.killbill.billing.plugin.meter.api.user.JsonSamplesOutputer.java
private void writeJsonForStoredChunks(final JsonGenerator generator, final List<Integer> hostIdsList, final List<Integer> sampleKindIdsList, final DateTime startTime, final DateTime endTime) throws IOException { final AtomicReference<Integer> lastHostId = new AtomicReference<Integer>(null); final AtomicReference<Integer> lastSampleKindId = new AtomicReference<Integer>(null); final List<TimelineChunk> chunksForHostAndSampleKind = new ArrayList<TimelineChunk>(); timelineDao.getSamplesBySourceIdsAndMetricIds(hostIdsList, sampleKindIdsList, startTime, endTime, new TimelineChunkConsumer() { @Override//from w w w .j ava2 s .co m public void processTimelineChunk(final TimelineChunk chunks) { final Integer previousHostId = lastHostId.get(); final Integer previousSampleKindId = lastSampleKindId.get(); final Integer currentHostId = chunks.getSourceId(); final Integer currentSampleKindId = chunks.getMetricId(); chunksForHostAndSampleKind.add(chunks); if (previousHostId != null && (!previousHostId.equals(currentHostId) || !previousSampleKindId.equals(currentSampleKindId))) { try { writeJsonForChunks(generator, chunksForHostAndSampleKind); } catch (IOException e) { throw new RuntimeException(e); } chunksForHostAndSampleKind.clear(); } lastHostId.set(currentHostId); lastSampleKindId.set(currentSampleKindId); } }, context); if (chunksForHostAndSampleKind.size() > 0) { writeJsonForChunks(generator, chunksForHostAndSampleKind); chunksForHostAndSampleKind.clear(); } }