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 package org.apache.camel;
018
019 /**
020 * A {@link Service} which has all the lifecycle events and offers details about its current state.
021 */
022 public interface StatefulService extends SuspendableService, ShutdownableService {
023
024 /**
025 * Returns the current status
026 *
027 * @return the current status
028 */
029 ServiceStatus getStatus();
030
031 /**
032 * Whether the service is started
033 *
034 * @return true if this service has been started
035 */
036 boolean isStarted();
037
038 /**
039 * Whether the service is starting
040 *
041 * @return true if this service is being started
042 */
043 boolean isStarting();
044
045 /**
046 * Whether the service is stopping
047 *
048 * @return true if this service is in the process of stopping
049 */
050 boolean isStopping();
051
052 /**
053 * Whether the service is stopped
054 *
055 * @return true if this service is stopped
056 */
057 boolean isStopped();
058
059 /**
060 * Whether the service is suspending
061 *
062 * @return true if this service is in the process of suspending
063 */
064 boolean isSuspending();
065
066 /**
067 * Helper methods so the service knows if it should keep running.
068 * Returns <tt>false</tt> if the service is being stopped or is stopped.
069 *
070 * @return <tt>true</tt> if the service should continue to run.
071 */
072 boolean isRunAllowed();
073
074 /**
075 * Returns the version of this service
076 *
077 * @return the version
078 */
079 String getVersion();
080
081 }