Change Thread Names Based On Current Request
To make thread dump debugging a lot more clear.

retrofit/src/main/java/retrofit/http/Platform.java retrofit/src/main/java/retrofit/http/RestAdapter.java
retrofit/src/main/java/retrofit/http/Platform.java retrofit/src/main/java/retrofit/http/RestAdapter.java
diff --git a/retrofit/src/main/java/retrofit/http/Platform.java b/retrofit/src/main/java/retrofit/http/Platform.java
index 377cdcc596..fa72a470c4 100644
--- a/retrofit/src/main/java/retrofit/http/Platform.java
+++ b/retrofit/src/main/java/retrofit/http/Platform.java
@@ -14,6 +14,7 @@
 
 import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
 import static retrofit.http.RestAdapter.SynchronousExecutor;
+import static retrofit.http.RestAdapter.THREAD_PREFIX;
 
 abstract class Platform {
   private static final Platform PLATFORM = findPlatform();
@@ -58,7 +59,7 @@ private static class Base extends Platform {
               Thread.currentThread().setPriority(THREAD_PRIORITY_BACKGROUND);
               r.run();
             }
-          }, "Retrofit-" + threadCounter.getAndIncrement());
+          }, THREAD_PREFIX + threadCounter.getAndIncrement());
         }
       });
     }
@@ -89,7 +90,7 @@ private static class Android extends Platform {
               Process.setThreadPriority(THREAD_PRIORITY_BACKGROUND);
               r.run();
             }
-          }, "Retrofit-" + threadCounter.getAndIncrement());
+          }, THREAD_PREFIX + threadCounter.getAndIncrement());
         }
       });
     }
diff --git a/retrofit/src/main/java/retrofit/http/RestAdapter.java b/retrofit/src/main/java/retrofit/http/RestAdapter.java
index fd3fa2e5d8..8f605c273b 100644
--- a/retrofit/src/main/java/retrofit/http/RestAdapter.java
+++ b/retrofit/src/main/java/retrofit/http/RestAdapter.java
@@ -44,6 +44,7 @@
 public class RestAdapter {
   private static final Logger LOGGER = Logger.getLogger(RestAdapter.class.getName());
   private static final int LOG_CHUNK_SIZE = 4000;
+  static final String THREAD_PREFIX = "Retrofit-";
 
   private final Server server;
   private final Provider<HttpClient> httpClientProvider;
@@ -141,6 +142,11 @@ private Object invokeRequest(Method method, Object[] args, boolean isSynchronous
             .build();
         url = request.getURI().toString();
 
+        if (!isSynchronousInvocation) {
+          // If we are executing asynchronously then update the current thread with a useful name.
+          Thread.currentThread().setName(THREAD_PREFIX + url);
+        }
+
         // Determine deserialization type by method return type or generic parameter to Callback argument.
         Type type = responseTypeCache.get(method);
         if (type == null) {
