Repository: karaf
Updated Branches:
  refs/heads/karaf-4.0.x ff5792d9b -> c652bd97a


Revert "[KARAF-4188] Add support for Systemd's watchdog"

This reverts commit 020d255ca4dc4da3b94651db45c1a85fffd8a6e9.


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/6a654fa3
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/6a654fa3
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/6a654fa3

Branch: refs/heads/karaf-4.0.x
Commit: 6a654fa3b535998ef0c0ba9c97e94ef27cfc0af1
Parents: ff5792d
Author: Jean-Baptiste Onofré <[email protected]>
Authored: Mon Dec 12 21:24:47 2016 +0100
Committer: Jean-Baptiste Onofré <[email protected]>
Committed: Mon Dec 12 21:24:47 2016 +0100

----------------------------------------------------------------------
 assemblies/apache-karaf/pom.xml                 |  3 -
 .../resources/etc/config.properties             |  5 --
 main/pom.xml                                    |  8 ---
 .../main/java/org/apache/karaf/main/Main.java   | 35 +----------
 .../org/apache/karaf/main/internal/Systemd.java | 64 --------------------
 .../karaf/main/internal/SystemdDaemon.java      | 34 -----------
 pom.xml                                         | 14 +----
 7 files changed, 2 insertions(+), 161 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/6a654fa3/assemblies/apache-karaf/pom.xml
----------------------------------------------------------------------
diff --git a/assemblies/apache-karaf/pom.xml b/assemblies/apache-karaf/pom.xml
index 3fc2053..6630dd9 100644
--- a/assemblies/apache-karaf/pom.xml
+++ b/assemblies/apache-karaf/pom.xml
@@ -205,9 +205,6 @@
 
                         
<library>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activator/${servicemix.specs.version};type:=default;export:=true</library>
                         
<library>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.locator/${servicemix.specs.version};type:=default;export:=true</library>
-
-                        
<library>mvn:net.java.dev.jna/jna/${jna.version};type:=boot;export:=false</library>
-                        
<library>mvn:net.java.dev.jna/jna-platform/${jna.version};type:=boot;export:=false</library>
                     </libraries>
                 </configuration>
             </plugin>

http://git-wip-us.apache.org/repos/asf/karaf/blob/6a654fa3/assemblies/features/base/src/main/filtered-resources/resources/etc/config.properties
----------------------------------------------------------------------
diff --git 
a/assemblies/features/base/src/main/filtered-resources/resources/etc/config.properties
 
b/assemblies/features/base/src/main/filtered-resources/resources/etc/config.properties
index 62b3f24..4cf7cc7 100644
--- 
a/assemblies/features/base/src/main/filtered-resources/resources/etc/config.properties
+++ 
b/assemblies/features/base/src/main/filtered-resources/resources/etc/config.properties
@@ -212,8 +212,3 @@ org.ops4j.pax.url.mvn.requireConfigAdminConfig=true
 # Don't delay the console startup. Set to true if you want the console to 
start after all other bundles
 #
 karaf.delay.console=false
-
-#
-# Enable native Karaf support for systemd's watchdog.
-#
-#karaf.systemd.enabled=false

http://git-wip-us.apache.org/repos/asf/karaf/blob/6a654fa3/main/pom.xml
----------------------------------------------------------------------
diff --git a/main/pom.xml b/main/pom.xml
index d8a387a..c7ceceb 100644
--- a/main/pom.xml
+++ b/main/pom.xml
@@ -54,14 +54,6 @@
             <groupId>org.apache.karaf</groupId>
             <artifactId>org.apache.karaf.util</artifactId>
         </dependency>
-        <dependency>
-            <groupId>net.java.dev.jna</groupId>
-            <artifactId>jna</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>net.java.dev.jna</groupId>
-            <artifactId>jna-platform</artifactId>
-        </dependency>
     </dependencies>
 
     <build>

http://git-wip-us.apache.org/repos/asf/karaf/blob/6a654fa3/main/src/main/java/org/apache/karaf/main/Main.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/Main.java 
b/main/src/main/java/org/apache/karaf/main/Main.java
index a760a66..9498082 100644
--- a/main/src/main/java/org/apache/karaf/main/Main.java
+++ b/main/src/main/java/org/apache/karaf/main/Main.java
@@ -34,13 +34,11 @@ import java.security.Security;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.StringTokenizer;
-import java.util.concurrent.TimeUnit;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.felix.utils.properties.Properties;
 import org.apache.karaf.info.ServerInfo;
-import org.apache.karaf.main.internal.Systemd;
 import org.apache.karaf.main.lock.Lock;
 import org.apache.karaf.main.lock.LockCallBack;
 import org.apache.karaf.main.lock.NoLock;
@@ -325,7 +323,6 @@ public class Main {
         }
         monitor();
         registerSignalHandler();
-        watchdog();
     }
 
     private void registerSignalHandler() {
@@ -407,37 +404,7 @@ public class Main {
     Lock getLock() {
         return lock;
     }
-
-    private void watchdog() {
-        if(Boolean.getBoolean("karaf.systemd.enabled")) {
-            new Thread("Karaf Systemd Watchdog Thread") {
-                public void run() {
-                    try {
-                        doWatchdog();
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
-                }
-            }.start();
-        }
-    }
-
-    private void doWatchdog() throws Exception {
-        Systemd systemd = new Systemd();
-        long timeout = systemd.getWatchdogTimeout(TimeUnit.MILLISECONDS);
-
-        int code;
-        while (!exiting && timeout > 0) {
-            code = systemd.notifyWatchdog();
-            if(code < 0) {
-                System.err.println("Systemd sd_notify failed with error code: 
" + code);
-                break;
-            }
-
-            Thread.sleep(timeout / 2);
-        }
-    }
-
+    
     private ClassLoader createClassLoader(ArtifactResolver resolver) throws 
Exception {
         List<URL> urls = new ArrayList<URL>();
         urls.add(resolver.resolve(config.frameworkBundle).toURL());

http://git-wip-us.apache.org/repos/asf/karaf/blob/6a654fa3/main/src/main/java/org/apache/karaf/main/internal/Systemd.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/internal/Systemd.java 
b/main/src/main/java/org/apache/karaf/main/internal/Systemd.java
deleted file mode 100644
index 888bc8b..0000000
--- a/main/src/main/java/org/apache/karaf/main/internal/Systemd.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.karaf.main.internal;
-
-
-import java.util.concurrent.TimeUnit;
-
-
-public class Systemd {
-    public static final String ENV_WATCHDOG_USEC = "WATCHDOG_USEC";
-    public static final String ENV_MAIN_PID = "SYSTEMD_MAIN_PID";
-
-    private final String mainPid;
-
-    public Systemd() {
-        this.mainPid = System.getProperty("karaf.systemd.main.pid", 
System.getenv(ENV_MAIN_PID));
-    }
-
-    public int notifyWatchdog() {
-        int rc = -1;
-
-        // WATCHDOG : tells the service manager to update the watchdog 
timestamp.
-        //            This is the keep-alive ping that services need to issue 
in
-        //            regular intervals if WatchdogSec= is enabled for it.
-        // MAINPID  : the main process ID (PID) of the service, in case the 
service
-        //            manager did not fork off the process itself. Example: 
"MAINPID=4711"
-        //            This does not seem to work reliably so used only if 
system
-        //            property karaf.systemd.main.pid or env variable 
SYSTEMD_MAIN_PID
-        //            are set (system property takes the precedence)
-        if(SystemdDaemon.INSTANCE != null) {
-            rc = SystemdDaemon.INSTANCE.sd_notify(
-                0,
-                (mainPid == null) ? "WATCHDOG=1" : ("MAINPID=" + mainPid + 
"\nWATCHDOG=1"));
-        }
-
-        return rc;
-    }
-
-    public long getWatchdogTimeout(TimeUnit timeUnit) {
-        String timeouts = System.getenv(ENV_WATCHDOG_USEC);
-        if(timeouts != null) {
-            long micros = Long.parseLong(timeouts);
-            return timeUnit.convert(micros, TimeUnit.MICROSECONDS);
-        }
-
-        return -1;
-    }
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/6a654fa3/main/src/main/java/org/apache/karaf/main/internal/SystemdDaemon.java
----------------------------------------------------------------------
diff --git 
a/main/src/main/java/org/apache/karaf/main/internal/SystemdDaemon.java 
b/main/src/main/java/org/apache/karaf/main/internal/SystemdDaemon.java
deleted file mode 100644
index 076cf1c..0000000
--- a/main/src/main/java/org/apache/karaf/main/internal/SystemdDaemon.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.karaf.main.internal;
-
-import com.sun.jna.Library;
-import com.sun.jna.Native;
-
-
-public interface SystemdDaemon extends Library {
-    SystemdDaemon INSTANCE = (SystemdDaemon) 
Native.loadLibrary("systemd-daemon", SystemdDaemon.class);
-
-    int sd_notify(int unset_environment, String state);
-    int sd_notifyf(int unset_environment, String format, Object... args);
-
-    // Not available in all systemd version, should replace used of MAINPID
-    // int sd_pid_notify(int pid, int unset_environment, String state);
-    // int sd_pid_notifyff(int pid, int unset_environment, String format, 
Object... args);
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/6a654fa3/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 909fb28..e3dd03d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -144,9 +144,7 @@
         <asm.springsource.version>1.5.3</asm.springsource.version>
         <cglib.bundle.version>3.2.4_1</cglib.bundle.version>
         <cglib2.version>2.2.0</cglib2.version>
-        
-        <jna.version>4.2.2</jna.version>
-        
+
         <commons-beanutils.version>1.9.2</commons-beanutils.version>
         <commons-codec.version>1.10</commons-codec.version>
         <commons-compress.version>1.12</commons-compress.version>
@@ -1037,16 +1035,6 @@
                 <version>${felix.connect.version}</version>
             </dependency>
 
-            <dependency>
-                <groupId>net.java.dev.jna</groupId>
-                <artifactId>jna</artifactId>
-                <version>${jna.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>net.java.dev.jna</groupId>
-                <artifactId>jna-platform</artifactId>
-                <version>${jna.version}</version>
-            </dependency>
 
             <dependency>
                 <groupId>org.ow2.asm</groupId>

Reply via email to