]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/jsch/AbstractJschTask.java
Disable sudo in LXC deployment
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.simple / src / main / java / org / argeo / slc / jsch / AbstractJschTask.java
index b27b4b354c02ebbb9c2b493a7374aaee2f98f9c8..ed37069ef3a14288230ff9abffc03109f49de3d2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
+ * Copyright (C) 2007-2012 Argeo GmbH
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.argeo.slc.jsch;
 
 import java.io.IOException;
@@ -53,12 +52,13 @@ public abstract class AbstractJschTask implements Runnable {
                                        getSshTarget().getHost(), getSshTarget().getPort());
 
                        session.setUserInfo(getSshTarget().getUserInfo());
+                       session.setServerAliveInterval(1000);
                        session.connect();
-                       if (log.isDebugEnabled())
-                               log.debug("Connected to " + getSshTarget() + " via SSH");
+                       if (log.isTraceEnabled())
+                               log.trace("Connected to " + getSshTarget() + " via SSH");
                        if (sshTarget.getSession() != null) {
-                               if (log.isDebugEnabled())
-                                       log.debug("The cached session to " + getSshTarget()
+                               if (log.isTraceEnabled())
+                                       log.trace("The cached session to " + getSshTarget()
                                                        + " was disconnected and was reset.");
                                sshTarget.setSession(session);
                        }
@@ -71,15 +71,15 @@ public abstract class AbstractJschTask implements Runnable {
                }
        }
 
-       public final void run() {
+       public void run() {
                Session session = openSession();
                try {
                        run(session);
                } finally {
                        if (sshTarget != null && sshTarget.getSession() == null) {
                                session.disconnect();
-                               if (log.isDebugEnabled())
-                                       log.debug("Disconnected from " + getSshTarget()
+                               if (log.isTraceEnabled())
+                                       log.trace("Disconnected from " + getSshTarget()
                                                        + " via SSH");
                        }
                }