
org.linkedin.glu.agent.api.StateManager.groovy Maven / Gradle / Ivy
/*
* Copyright (c) 2010-2010 LinkedIn, Inc
*
* 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 org.linkedin.glu.agent.api
/**
* This interface is available from any GLU script using stateManager
property
*
* Each script is backed by a state machine (org.linkedin.glu.util.state.StateMachine
).
*
* @author [email protected] */
interface StateManager
{
/**
* @return the state of the script (from a state machine point of view) (see info
* org.linkedin.glu.util.state.StateMachine#getState()
)
*/
def getState()
/**
* @return a map with the following definition:
* [
* scriptDefinition: [ mountPoint: x,
* parent: x,
* scriptFactory: x,
* initParameters: x ], // all values provided when installing the glu script
* scriptState: [
* script: [x:x], // all serializable variables in the glu script
* stateMachine: getState(),
* timers: [[timer: x, repeatFrequency: x], ...]
* ]
* ]
*
*/
def getFullState()
/**
* This method is used to change the state and should be used carefully. This method cannot
* be used when in transition state
*
* @param currentState the new current state (can be null
in which case we keep
* the current one)
* @param error the new error state
*/
void forceChangeState(currentState, error)
/**
* This method waits for the script to be in shutdown state: the script is put in shutdown state
* when the agent shutdowns. Note that {@link #getState()} and {@link @getFullState()} still
* return their normal value.
*/
void waitForShutdownState()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy