Early return instead of remove on a blockingdeque

This commit is contained in:
fullwall 2014-09-12 21:46:02 +08:00
parent 4e5348ce45
commit 8a1d8e3106

View File

@ -162,7 +162,9 @@ public class HumanController extends AbstractEntityController {
((YggdrasilMinecraftSessionService) repo).getAuthenticationService(),
new GameProfile(UUID.fromString(realUUID), ""), true);
} catch (Exception e) {
if (e.getMessage() != null && e.getMessage().contains("too many requests")) {
if ((e.getMessage() != null && e.getMessage().contains("too many requests"))
|| (e.getCause() != null && e.getCause().getMessage() != null && e.getCause().getMessage()
.contains("too many requests"))) {
SKIN_THREAD.delay();
SKIN_THREAD.addRunnable(this);
}
@ -202,7 +204,7 @@ public class HumanController extends AbstractEntityController {
Iterator<Runnable> itr = tasks.iterator();
while (itr.hasNext()) {
if (((SkinFetcher) itr.next()).npc.getUniqueId().equals(((SkinFetcher) r).npc.getUniqueId())) {
itr.remove();
return;
}
}
tasks.offer(r);