public class HashMapService extends Object
ProfileService backed by a ConcurrentHashMap.| Constructor and Description |
|---|
HashMapService()
Create a new instance.
|
HashMapService(Map<String,UUID> map)
Create a new instance and add the entries of the given map
to the internal map.
|
| 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.
|
int |
getIdealRequestLimit()
Get the optimal maximum number of profiles that can be found
with one
ProfileService.findAllByName(Iterable) call. |
void |
put(Profile profile)
Add the given profile to the internal map.
|
void |
putAll(Collection<Profile> profiles)
Add the given profiles to the internal map.
|
public void put(Profile profile)
profile - the profilepublic void putAll(Collection<Profile> profiles)
profiles - a collection 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.
@Nullable public Profile findByName(String name) throws IOException, InterruptedException
ProfileServicename - a namenullIOException - thrown on I/O errorInterruptedException - thrown on interruptionpublic final 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 final 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.