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
019package 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 * @version $Id: ProcessDestroyer.java 1557385 2014-01-11 13:19:33Z sebb $
027 */
028public interface ProcessDestroyer {
029
030    /**
031     * Returns <code>true</code> if the specified
032     * {@link java.lang.Process} was
033     * successfully added to the list of processes to be destroy.
034     *
035     * @param process
036     *      the process to add
037     * @return <code>true</code> if the specified
038     *      {@link java.lang.Process} was
039     *      successfully added
040     */
041    boolean add(Process process);
042
043    /**
044     * Returns <code>true</code> if the specified
045     * {@link java.lang.Process} was
046     * successfully removed from the list of processes to be destroy.
047     *
048     * @param process
049     *            the process to remove
050     * @return <code>true</code> if the specified
051     *      {@link java.lang.Process} was
052     *      successfully removed
053     */
054    boolean remove(Process process);
055
056    /**
057     * Returns the number of registered processes.
058     *
059     * @return the number of register process
060     */
061    int size();
062}