@@ -342,17 +342,13 @@ public synchronized void boost()
342342 }
343343 }
344344
345- /** List of channels to search, re-used within runSearches */
346- private final ArrayList <PVAChannel > to_search = new ArrayList <>();
347-
348345 /** Invoked by timer: Check searched channels for the next one to handle */
349- @ SuppressWarnings ("unchecked" )
350346 private void runSearches ()
351347 {
352348 // Determine current search bucket
353349 final int current = current_search_bucket .getAndUpdate (i -> (i + 1 ) % search_buckets .size ());
354350 // Collect channels to be searched while sync'ed
355- to_search . clear ();
351+ final ArrayList < SearchRequest . Channel > to_search = new ArrayList <> ();
356352 synchronized (this )
357353 {
358354 final Set <SearchedChannel > bucket = search_buckets .get (current );
@@ -406,7 +402,7 @@ private void runSearches()
406402 int count = 0 ;
407403 while (start + count < to_search .size () && count < Short .MAX_VALUE -1 )
408404 {
409- final PVAChannel channel = to_search .get (start + count );
405+ final SearchRequest . Channel channel = to_search .get (start + count );
410406 int size = 4 + PVAString .getEncodedSize (channel .getName ());
411407 if (payload + size < MAX_SEARCH_PAYLOAD )
412408 {
@@ -428,9 +424,9 @@ else if (count == 0)
428424 if (count == 0 )
429425 break ;
430426
431- final List < PVAChannel > batch = to_search . subList ( start , start + count );
432- // PVAChannel extends SearchRequest.Channel, so use List<PVAChannel> as Collection<SR.Channel>
433- search (( Collection < SearchRequest . Channel >) ( List <? extends SearchRequest . Channel >) batch );
427+ // Submit one batch from ' to_search'
428+ final List < SearchRequest .Channel > batch = to_search . subList ( start , start + count );
429+ search (batch );
434430 start += count ;
435431 }
436432 }
0 commit comments