commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r823641 - in /commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime: KillConditions.java LocalStrings.properties ResourceLimit.java
Date Fri, 09 Oct 2009 17:54:52 GMT
Author: mturk
Date: Fri Oct  9 17:54:52 2009
New Revision: 823641

URL: http://svn.apache.org/viewvc?rev=823641&view=rev
Log:
Add two process related enums

Added:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/KillConditions.java
  (with props)
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ResourceLimit.java
  (with props)
Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/LocalStrings.properties

Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/KillConditions.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/KillConditions.java?rev=823641&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/KillConditions.java
(added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/KillConditions.java
Fri Oct  9 17:54:52 2009
@@ -0,0 +1,59 @@
+/* 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.commons.runtime;
+
+import org.apache.commons.runtime.util.StringManager;
+
+/**
+ * How to kill the process.
+ */
+public enum KillConditions
+{
+    /** Process is never sent any signals */
+    KILL_NEVER(         0),
+    /** Process is sent SIGKILL on Pool cleanup */
+    KILL_ALWAYS(        1),
+    /** Send SIGTERM, wait 3 seconds, SIGKILL */
+    KILL_AFTER_TIMEOUT( 2),
+    /** Wait forever for the process to complete */
+    JUST_WAIT(          3),
+    /** Send SIGTERM and then wait */
+    KILL_ONLY_ONCE(     4);
+
+
+    private int value;
+    private KillConditions(int v)
+    {
+        value = v;
+    }
+
+    public int valueOf()
+    {
+        return value;
+    }
+
+    public static KillConditions valueOf(int value)
+        throws IllegalArgumentException
+    {
+        for (KillConditions e : values()) {
+            if (e.value == value)
+                return e;
+        }
+        throw new IllegalArgumentException(Local.sm.get("killcond.EINVAL", value));
+    }
+
+}

Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/KillConditions.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/LocalStrings.properties
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/LocalStrings.properties?rev=823641&r1=823640&r2=823641&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/LocalStrings.properties
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/LocalStrings.properties
Fri Oct  9 17:54:52 2009
@@ -16,3 +16,5 @@
 os.ENOTIMPL=Apache Commons Runtime does not support this operating system
 os.EVERSION=Apache Commons Runtime does not support this operating system version
 waithow.EINVAL=Invalid WaitHow enum initializer ({0})
+reslimit.EINVAL=Invalid ResourceLimit enum initializer ({0})
+killcond.EINVAL=Invalid KillConditions enum initializer ({0})

Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ResourceLimit.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ResourceLimit.java?rev=823641&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ResourceLimit.java
(added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ResourceLimit.java
Fri Oct  9 17:54:52 2009
@@ -0,0 +1,74 @@
+/* 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.commons.runtime;
+
+import org.apache.commons.runtime.util.StringManager;
+
+/**
+ * Resource Utilization limits when starting a new process.
+ */
+public enum ResourceLimit
+{
+    /**
+     * The maximum amount of CPU time in seconds used by a
+     * process. This is a soft limit only. The SIGXCPU
+     * signal is sent to the process. If the process is holding
+     * or ignoring SIGXCPU, the behavior is scheduling class defined.
+     */
+    CPU(    0),
+
+    /**
+     * The maximum size of a process's heap in bytes. The
+     * memory allocation functions will fail with errno set to ENOMEM.
+     */
+    MEM(    1),
+
+    /**
+     * Number of child processes the process may create.
+     */
+    NPROC(  2),
+
+    /**
+     * One more than the maximum value that the system may
+     * assign to a newly created descriptor. This limit constrains
+     * the number of file descriptors that a process may create.
+     */
+    NOFILE( 3);
+
+
+    private int value;
+    private ResourceLimit(int v)
+    {
+        value = v;
+    }
+
+    public int valueOf()
+    {
+        return value;
+    }
+
+    public static ResourceLimit valueOf(int value)
+        throws IllegalArgumentException
+    {
+        for (ResourceLimit e : values()) {
+            if (e.value == value)
+                return e;
+        }
+        throw new IllegalArgumentException(Local.sm.get("reslimit.EINVAL", value));
+    }
+
+}

Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ResourceLimit.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message