public class ParallelProfileService extends Object implements ProfileService
| Constructor and Description |
|---|
ParallelProfileService(ProfileService resolver,
ExecutorService executorService)
Create a new parallel resolver.
|
ParallelProfileService(ProfileService resolver,
int nThreads)
Create a new parallel resolver.
|
| Modifier and Type | Method and Description |
|---|---|
com.google.common.collect.ImmutableList<Profile> |
findAllByName(Iterable<String> names)
Query the profile server for UUIDs for the given names.
|
void |
findAllByName(Iterable<String> names,
com.google.common.base.Predicate<Profile> consumer)
Query the profile server for UUIDs for the given names.
|
Profile |
findByName(String name)
Query the profile server for the UUID of a name.
|
protected int |
getEffectiveProfilesPerJob()
Get the number or profiles to execute per job.
|
int |
getIdealRequestLimit()
Get the optimal maximum number of profiles that can be found
with one
ProfileService.findAllByName(Iterable) call. |
int |
getProfilesPerJob()
Get the upper bound number of profiles to find per thread.
|
void |
setProfilesPerJob(int profilesPerJob)
Set the upper bound number of profiles to find per thread.
|
public ParallelProfileService(ProfileService resolver, ExecutorService executorService)
resolver - the resolver to useexecutorService - the executor service to schedule jobs inpublic ParallelProfileService(ProfileService resolver, int nThreads)
resolver - the resolver to usenThreads - the number of threads to resolve profiles inpublic int getProfilesPerJob()
public void setProfilesPerJob(int profilesPerJob)
profilesPerJob - a number of profilespublic int getIdealRequestLimit()
ProfileServiceProfileService.findAllByName(Iterable) call.
ProfileService.findAllByName(Iterable) (and similar) methods may split up
requests into smaller ones to fit within one request. This method
returns the ideal maximum number.
getIdealRequestLimit in interface ProfileServiceprotected int getEffectiveProfilesPerJob()
@Nullable public Profile findByName(String name) throws IOException, InterruptedException
ProfileServicefindByName in interface ProfileServicename - a namenullIOException - thrown on I/O errorInterruptedException - thrown on interruptionpublic com.google.common.collect.ImmutableList<Profile> findAllByName(Iterable<String> names) throws IOException, InterruptedException
ProfileServicefindAllByName in interface ProfileServicenames - an iterable containing names to searchIOException - thrown on I/O errorInterruptedException - thrown on interruptionpublic void findAllByName(Iterable<String> names, com.google.common.base.Predicate<Profile> consumer) throws IOException, InterruptedException
ProfileServicefindAllByName in interface ProfileServicenames - an iterable containing names to searchconsumer - a consumer function that will receive discovered profilesIOException - thrown on I/O errorInterruptedException - thrown on interruptionCopyright © 2014. All Rights Reserved.