Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 99627 invoked from network); 9 Oct 2009 17:55:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Oct 2009 17:55:19 -0000 Received: (qmail 3056 invoked by uid 500); 9 Oct 2009 17:55:17 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 2994 invoked by uid 500); 9 Oct 2009 17:55:17 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 2969 invoked by uid 99); 9 Oct 2009 17:55:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Oct 2009 17:55:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Oct 2009 17:55:14 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9D59F23888FF; Fri, 9 Oct 2009 17:54:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@commons.apache.org From: mturk@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091009175452.9D59F23888FF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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