All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aspectran.core.service.ServiceController Maven / Gradle / Ivy

There is a newer version: 8.1.3
Show newest version
/*
 * Copyright (c) 2008-2019 The Aspectran Project
 *
 * Licensed 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 com.aspectran.core.service;

/**
 * The Interface ServiceController.
 */
public interface ServiceController {

    /**
     * Returns the name of this service.
     *
     * @return the name of this service
     */
    String getServiceName();

    /**
     * Sets the service state listener.
     *
     * @param serviceStateListener the new service state listener
     */
    void setServiceStateListener(ServiceStateListener serviceStateListener);

    /**
     * Starts the service.
     *
     * @throws Exception if the service control fails
     */
    void start() throws Exception;

    /**
     * Restarts the service.
     *
     * @throws Exception if the service control fails
     */
    void restart() throws Exception;

    /**
     * Restarts the service.
     *
     * @param message the message to be delivered to the system before restart
     * @throws Exception if the service control fails
     */
    void restart(String message) throws Exception;

    /**
     * Pauses the service.
     *
     * @throws Exception if the service control fails
     */
    void pause() throws Exception;

    /**
     * Pauses the service for a specified period of time.
     *
     * @param timeout the maximum time to wait in milliseconds.
     * @throws Exception if the service control fails
     */
    void pause(long timeout) throws Exception;

    /**
     * Continues the service after it has been paused.
     *
     * @throws Exception if the service control fails
     */
    void resume() throws Exception;

    /**
     * Stops the service.
     * Destroys any services and resources that are dependent on this service.
     */
    void stop();

    /**
     * Returns whether this service is currently started and active.
     *
     * @return true, if the service is active; false otherwise
     */
    boolean isActive();

    /**
     * Returns whether this service has any work in progress.
     *
     * @return true, if this service is busy; false otherwise
     */
    boolean isBusy();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy