Revision: 1237
Author: dhanji
Date: Wed Sep 15 22:38:18 2010
Log: Minor cleanups, removing some debug stuff that snuck into the previous commit.
http://code.google.com/p/google-guice/source/detail?r=1237

Modified:
 /trunk/extensions/service/src/com/google/inject/service/AsyncService.java
/trunk/extensions/service/src/com/google/inject/service/CompositeService.java

=======================================
--- /trunk/extensions/service/src/com/google/inject/service/AsyncService.java Wed Sep 15 22:32:53 2010 +++ /trunk/extensions/service/src/com/google/inject/service/AsyncService.java Wed Sep 15 22:38:18 2010
@@ -18,7 +18,6 @@

 import com.google.inject.internal.util.Preconditions;
 import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 import java.util.concurrent.FutureTask;
@@ -54,16 +53,12 @@
       return new FutureTask<State>(NOOP, State.STARTED);
     }

-    final Future<State> task = executor.submit(new Callable<State>() {
+    return executor.submit(new Callable<State>() {
       public State call() {
         onStart();
         return state = State.STARTED;
       }
     });
-
-    return task;
-    // Wrap it in another future to catch failures.
-//    return new FutureTask<State>(futureGet(task));
   }

   /**
@@ -83,18 +78,12 @@
       return new FutureTask<State>(NOOP, State.STOPPED);
     }

-    // TODO Should we bother doing the wrap, or is it enough to return
-    // this future as is?
-    final Future<State> task = executor.submit(new Callable<State>() {
+    return executor.submit(new Callable<State>() {
       public State call() {
         onStop();
         return state = State.STOPPED;
       }
     });
-
-    // Wrap it in another future to catch failures.
-    return task;
-//    return new FutureTask<State>(futureGet(task));
   }

   /**
@@ -109,23 +98,4 @@
   public final State state() {
     return state;
   }
-
-  /**
-   * Returns a runnable that when run will get() the given future and
-   * update {...@link #state} to FAILED if there was an exception thrown.
-   */
-  private Callable<State> futureGet(final Future<State> task) {
-    return new Callable<State>() {
-      public State call() {
-        try {
-          System.out.println("FutureGEtting");
-          return task.get();
-        } catch (InterruptedException e) {
-          return state = State.FAILED;
-        } catch (ExecutionException e) {
-          return state = State.FAILED;
-        }
-      }
-    };
-  }
-}
+}
=======================================
--- /trunk/extensions/service/src/com/google/inject/service/CompositeService.java Wed Sep 15 22:32:53 2010 +++ /trunk/extensions/service/src/com/google/inject/service/CompositeService.java Wed Sep 15 22:38:18 2010
@@ -104,13 +104,10 @@
       final Service.State state) {
     return new FutureTask<Service.State>(new Callable<Service.State>() {
       public Service.State call() {
-        System.out.println("GeT :--- ");
         boolean ok = true;
         for (Future<Service.State> task : tasks) {
           try {
-            System.out.println("GeT : " + task);
             ok = state == task.get();
-            System.out.println("OK : " + task);
           } catch (InterruptedException e) {
             return compositeState = Service.State.FAILED;
           } catch (ExecutionException e) {

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en.

Reply via email to