public class HttpRepositoryService extends Object implements ProfileService
| Modifier and Type | Field and Description |
|---|---|
static String |
MINECRAFT_AGENT |
| Constructor and Description |
|---|
HttpRepositoryService(String agent)
Create a new 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.
|
static ProfileService |
forMinecraft()
Create a resolver for Minecraft.
|
int |
getIdealRequestLimit()
Get the optimal maximum number of profiles that can be found
with one
ProfileService.findAllByName(Iterable) call. |
int |
getMaxRetries()
Get the maximum number of HTTP request retries.
|
long |
getRetryDelay()
Get the number of milliseconds to delay after each failed HTTP request,
doubling each time until success or total failure.
|
protected com.google.common.collect.ImmutableList<Profile> |
query(Iterable<String> names)
Perform a query for profiles without partitioning the queries.
|
void |
setMaxRetries(int maxRetries)
Set the maximum number of HTTP request retries.
|
void |
setRetryDelay(long retryDelay)
Set the number of milliseconds to delay after each failed HTTP request,
doubling each time until success or total failure.
|
public static final String MINECRAFT_AGENT
public HttpRepositoryService(String agent)
For Minecraft, use the MINECRAFT_AGENT constant. The UUID
to name mapping is only available if a user owns the game for the
provided "agent," so an incorrect agent may return zero results or
incorrect results.
agent - the agent (i.e. the game)public int getMaxRetries()
public void setMaxRetries(int maxRetries)
maxRetries - the maximum number of retriespublic long getRetryDelay()
public void setRetryDelay(long retryDelay)
retryDelay - delay in millisecondspublic 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 ProfileService@Nullable public Profile findByName(String name) throws IOException, InterruptedException
ProfileServicefindByName in interface ProfileServicename - a namenullIOException - 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 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 interruptionprotected com.google.common.collect.ImmutableList<Profile> query(Iterable<String> names) throws IOException, InterruptedException
names - an iterable of namesIOException - thrown on I/O errorInterruptedException - thrown on interruptionpublic static ProfileService forMinecraft()
Copyright © 2014. All Rights Reserved.