javax.inject.Injectcom.google.inject.Inject



Project jclouds/legacy-jclouds in file ...rg.jclouds.rest.internal.AsyncRestClientProxy.java (2009-11-17)
@@ -36,7 +36,6 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
 import javax.annotation.Resource;
-import javax.inject.Inject;
 import javax.inject.Named;
 import javax.inject.Singleton;
 
@@ -49,6 +48,7 @@ import org.jclouds.logging.Logger;
 import org.jclouds.rest.InvocationContext;
 
 import com.google.common.base.Function;
+import com.google.inject.Inject;
 import com.google.inject.Injector;
 import com.google.inject.TypeLiteral;
 import com.google.inject.internal.Nullable;
@@ -88,7 +88,8 @@ public class AsyncRestClientProxy<T> implements InvocationHandler {
          return this.hashCode();
       } else if (method.getName().startsWith("new")) {
          return injector.getInstance(method.getReturnType());
-      } else if (util.getDelegateOrNull(method) != null &&Future.class.isAssignableFrom(method.getReturnType())) {
+      } else if (util.getDelegateOrNull(method) != null
+               && Future.class.isAssignableFrom(method.getReturnType())) {
          method = util.getDelegateOrNull(method);
          logger.trace("Converting %s.%s", declaring.getSimpleName(), method.getName());
          Function<Exception, ?> exceptionParser = util
Project ninjaframework/ninja in file ...-core.src.main.java.ninja.utils.ResultHandler.java (2014-05-30)
@@ -16,13 +16,11 @@
 
 package ninja.utils;
 
+import com.google.inject.Inject;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.Writer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
-import javax.inject.Inject;
 import javax.inject.Singleton;
 
 import ninja.AsyncResult;
@@ -31,6 +29,7 @@ import ninja.Renderable;
 import ninja.Result;
 import ninja.template.TemplateEngine;
 import ninja.template.TemplateEngineManager;
+import org.slf4j.Logger;
 
 /**
  * Handles the result
@@ -97,7 +96,7 @@ public class ResultHandler {
         try {
             renderable.render(context, result);
         } catch (Exception e) {
-            logger.log(Level.SEVERE, "Error while handling renderable", e);
+            logger.error("Error while handling renderable", e);
         }
     }
 
Project jclouds/jclouds in file ...uds.ec2.compute.strategy.EC2ListNodesStrategy.java (2012-07-16)
@@ -31,7 +31,6 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 
 import javax.annotation.Resource;
-import javax.inject.Inject;
 import javax.inject.Named;
 import javax.inject.Singleton;
 
@@ -51,6 +50,7 @@ import com.google.common.base.Function;
 import com.google.common.base.Predicate;
 import com.google.common.base.Supplier;
 import com.google.common.collect.ImmutableSet;
+import com.google.inject.Inject;
 
 /**
  * 
@@ -58,10 +58,15 @@ import com.google.common.collect.ImmutableSet;
  */
 @Singleton
 public class EC2ListNodesStrategy implements ListNodesStrategy {
+
    @Resource
    @Named(ComputeServiceConstants.COMPUTE_LOGGER)
    protected Logger logger = Logger.NULL;
 
+   @Inject(optional = true)
+   @Named(Constants.PROPERTY_REQUEST_TIMEOUT)
+   protected static Long maxTime;
+
    protected final EC2AsyncClient client;
    protected final Supplier<Set<String>> regions;
    protected final Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata;
@@ -100,7 +105,7 @@ public class EC2ListNodesStrategy implements ListNodesStrategy {
                      return castToSpecificTypedFuture(client.getInstanceServices().describeInstancesInRegion(from));
                   }
 
-               }, executor, null, logger, "reservations");
+               }, executor, maxTime, logger, "reservations");
 
       return concat(concat(reservations));
    }
Project jclouds/legacy-jclouds in file ...uds.ec2.compute.strategy.EC2ListNodesStrategy.java (2012-07-16)
@@ -31,7 +31,6 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 
 import javax.annotation.Resource;
-import javax.inject.Inject;
 import javax.inject.Named;
 import javax.inject.Singleton;
 
@@ -51,6 +50,7 @@ import com.google.common.base.Function;
 import com.google.common.base.Predicate;
 import com.google.common.base.Supplier;
 import com.google.common.collect.ImmutableSet;
+import com.google.inject.Inject;
 
 /**
  * 
@@ -58,10 +58,15 @@ import com.google.common.collect.ImmutableSet;
  */
 @Singleton
 public class EC2ListNodesStrategy implements ListNodesStrategy {
+
    @Resource
    @Named(ComputeServiceConstants.COMPUTE_LOGGER)
    protected Logger logger = Logger.NULL;
 
+   @Inject(optional = true)
+   @Named(Constants.PROPERTY_REQUEST_TIMEOUT)
+   protected static Long maxTime;
+
    protected final EC2AsyncClient client;
    protected final Supplier<Set<String>> regions;
    protected final Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata;
@@ -100,7 +105,7 @@ public class EC2ListNodesStrategy implements ListNodesStrategy {
                      return castToSpecificTypedFuture(client.getInstanceServices().describeInstancesInRegion(from));
                   }
 
-               }, executor, null, logger, "reservations");
+               }, executor, maxTime, logger, "reservations");
 
       return concat(concat(reservations));
    }
Project jclouds/jclouds in file ...n.java.org.jclouds.compute.internal.UtilsImpl.java (2010-06-29)
@@ -20,7 +20,6 @@ package org.jclouds.compute.internal;
 
 import java.util.concurrent.ExecutorService;
 
-import javax.inject.Inject;
 import javax.inject.Named;
 import javax.inject.Singleton;
 
@@ -31,27 +30,27 @@ import org.jclouds.encryption.EncryptionService;
 import org.jclouds.logging.Logger.LoggerFactory;
 import org.jclouds.rest.HttpAsyncClient;
 import org.jclouds.rest.HttpClient;
-import org.jclouds.ssh.SshClient;
 import org.jclouds.ssh.SshClient.Factory;
 
+import com.google.inject.Inject;
+
 /**
  * 
  * @author Adrian Cole
  */
 @Singleton
 public class UtilsImpl extends org.jclouds.rest.internal.UtilsImpl implements Utils {
-
-   private final Factory sshFactory;
+   @Inject(optional = true)
+   private Factory sshFactory;
 
    @Inject
    UtilsImpl(HttpClient simpleClient, HttpAsyncClient simpleAsyncClient,
             EncryptionService encryption, DateService date,
             @Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads,
             @Named(Constants.PROPERTY_IO_WORKER_THREADS) ExecutorService ioThreads,
-            LoggerFactory loggerFactory, SshClient.Factory sshFactory) {
+            LoggerFactory loggerFactory) {
       super(simpleClient, simpleAsyncClient, encryption, date, userThreads, ioThreads,
                loggerFactory);
-      this.sshFactory = sshFactory;
    }
 
    @Override