001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 *
017 */
018
019 package org.apache.commons.exec;
020
021 /**
022 * Destroys all registered {@link java.lang.Process} after a certain event,
023 * typically when the VM exits
024 * @see org.apache.commons.exec.ShutdownHookProcessDestroyer
025 */
026 public interface ProcessDestroyer {
027
028 /**
029 * Returns <code>true</code> if the specified
030 * {@link java.lang.Process} was
031 * successfully added to the list of processes to be destroy.
032 *
033 * @param process
034 * the process to add
035 * @return <code>true</code> if the specified
036 * {@link java.lang.Process} was
037 * successfully added
038 */
039 boolean add(Process process);
040
041 /**
042 * Returns <code>true</code> if the specified
043 * {@link java.lang.Process} was
044 * successfully removed from the list of processes to be destroy.
045 *
046 * @param process
047 * the process to remove
048 * @return <code>true</code> if the specified
049 * {@link java.lang.Process} was
050 * successfully removed
051 */
052 boolean remove(Process process);
053
054 /**
055 * Returns the number of registered processes.
056 *
057 * @return the number of register process
058 */
059 int size();
060 }