ABLE 2.3.0 07/13/2005 14:21:00

com.ibm.able.autotune
Class AutotuneAgent

java.lang.Object
  extended bycom.ibm.able.AbleObject
      extended bycom.ibm.able.AbleDefaultAgent
          extended bycom.ibm.able.AbleRemoteDefaultAgent
              extended bycom.ibm.able.autotune.AutotuneAgent
All Implemented Interfaces:
AbleAgent, AbleBean, AbleBeanContainer, AbleBeanRemoteContainer, AbleDataBufferManager, AbleEventListener, AbleEventListenerManager, AbleEventListenerRemoteManager, AbleEventQueueManager, AbleEventQueueProcessor, AbleEventQueueRemoteManager, AblePropertyChangeManager, AbleRemoteAgent, AbleRemoteBean, AbleRemoteEventListener, AbleSerializable, AbleUserDefinedFunctionManager, AbleUserDefinedFunctionRemoteManager, AutotuneAgentIf, java.util.EventListener, java.beans.PropertyChangeListener, java.rmi.Remote, java.io.Serializable

public class AutotuneAgent
extends AbleRemoteDefaultAgent
implements AutotuneAgentIf, java.io.Serializable

Base Autotune Agent for Generic Adaptive Control.

An Autotune Agent contains adaptors which gather data at specified intervals. It maintains a registry of all the metrics collected by the adaptors. It contains a master controller which takes actions using the adaptor-collected data as input.

See Also:
Serialized Form

Field Summary
protected  int controllerRate
          The rate at which the agent's masterController is processed; in milliseconds.
protected  AutotuneDataBean dataBean
          Holder for data to be shipped between remote agent and client agent
protected  java.lang.String dataRepositoryPath
          The base directory used to store logging data.
protected  int defaultAdaptorRate
          The rate in milliseconds at which the agent's masterController is processed.
protected  AutotuneController masterController
          The controller that gets called each time the autotune agent is processed.
protected  AutotuneMetricManager metricManager
          A registry of all metrics available for use in this agent.
protected  AutotuneAgentIf remoteAgent
          The remote agent (if connected via customizer)
protected  boolean synchronousAdaptorMode
          A boolean indicating whether or not adaptors collect their data synchronously when this agent is prcoessed.
 
Fields inherited from class com.ibm.able.AbleRemoteDefaultAgent
agentAddr, agentHost, agentName, defaultName, myRemoteStub
 
Fields inherited from class com.ibm.able.AbleDefaultAgent
activeDataSource, eventConnections, myBeans, numEpochs, processList, processListOK, userDefinedFunctions
 
Fields inherited from class com.ibm.able.AbleObject
changed, chgSupport, comment, dataFlowEnabled, destBufferConnections, eventQueue, fileName, inputBuffer, listeners, logger, name, outputBuffer, parent, properties, propertyConnectionMgr, sourceBufferConnections, state, stateChgSupport, trace
 
Constructor Summary
AutotuneAgent()
           
AutotuneAgent(java.lang.String aName)
           
 
Method Summary
 java.util.Vector getAdaptors()
          Return all beans which are AutotuneAdaptors.
 int getControllerRate()
          Return the time period between processing the masterController.
 java.util.Vector getControllers()
          Return all beans which are AutotuneControllers.
 java.lang.Object getDataBean()
           
 java.lang.String getDataRepositoryPath()
          Get the base directory used to store logging data.
 int getDefaultAdaptorRate()
           
 boolean getLogData()
          Return whether logging is on or off.
 java.lang.String getLogDataFileName()
          Get the name of the file where log data is written.
 AutotuneMetricCollection getLoggingMetrics()
          Get the collection of selected metrics for logging.
 AutotuneController getMasterController()
          Return the controller serving as masterController in this agent.
 AutotuneMetric getMetric(java.lang.String metricName)
          Return the metric with the specified name.
 AutotuneMetricCollection getMetrics()
          Get all metrics defined by all adaptors in this agent.
 AutotuneAgentIf getRemoteAgent()
          Retrieve the remote agent reference (if any)
 boolean hasRemoteAgent()
          Returns true if this agent is acting as a local proxy for a remote agent
 void init()
          Initialize the autotune agent.
 boolean isLogData()
          Return whether logging is on or off.
 boolean isSynchronousAdaptorMode()
          Return the flag indicating whether adaptors are to be processed synchronously.
 void process()
          Check the current state of the target system if the adaptor mode is synchronous by processing each adaptor.
 void processAbleEvent(AbleEvent theAbleEvent)
          Process an Able event synchronously; that is, on the same thread as the caller.
 void processTimerEvent()
          Current behavior is to simply call the process() method.
 void reset()
          Restore processing options to default values.
 void setControllerRate(int rate)
          Set the time period between processing the masterController.
 void setDataBean(java.lang.Object theDataBean)
           
 void setDataRepositoryPath(java.lang.String path)
          Set the base directory used to store logging data.
 void setDefaultAdaptorRate(int rate)
           
 void setLogData(boolean state)
          Turn logging on or off.
 void setLogDataFileName(java.lang.String fileName)
          Set the name of the file used to write log data.
 void setLoggingMetrics(AutotuneMetricCollection loggingMetrics)
          Set the collection of selected metrics for logging.
 void setMasterController(AutotuneController controller)
          Select which controller should be master.
 boolean setMasterController(java.lang.String theName)
          Set the master controller using its name.
 void setRemoteAgent(AutotuneAgentIf theRemoteAgent)
          Set the remote agent reference
 void setSynchronousAdaptorMode(boolean state)
          Set the flag used to determine whether to process each adaptor before processing the masterController.
 void writeLogData()
          Write system state and control actions to log file for post mortem analysis, and replay if desired.
 
Methods inherited from class com.ibm.able.AbleRemoteDefaultAgent
getAgentAddr, getAgentHost, getAgentName, init, rmiRebind, rmiUnbind
 
Methods inherited from class com.ibm.able.AbleDefaultAgent
addBean, addBeans, addEventConnection, addUserDefinedFunction, buildProcessList, clsNm, containsBean, containsBean, containsUserDefinedFunction, debugTrace, generateUniqueName, getBean, getBeans, getDataSource, getEventConnections, getNumEpochs, getProcessList, getUserDefinedFunction, getUserDefinedFunctions, handleAbleEvent, initAllBeans, invokeUserDefinedFunction, isActiveDataSource, propertyChange, quitAll, quitEnabledEventProcessing, removeAllBeans, removeAllConnections, removeAllEventConnections, removeBean, removeBean, removeBeans, removeEventConnection, removeUserDefinedFunction, resetAllBeans, resumeAll, setActiveDataSource, setDataFlowEnabled, setProcessList, setUserDefinedFunctions, suspendAll
 
Methods inherited from class com.ibm.able.AbleObject
addAbleEventListener, addDestBufferConnection, addPropertyChangeListener, addPropertyConnection, addSourceBufferConnection, addStateChangeListener, dataChanged, firePropertyChange, flushAbleEventQueue, getAbleEventListeners, getAbleEventProcessingEnabled, getAbleEventQueueSize, getComment, getDestBufferConnections, getFileName, getInputBuffer, getInputBuffer, getInputBufferAsString, getInputBufferAsStringArray, getInputBufferContents, getLogger, getName, getOutputBuffer, getOutputBuffer, getOutputBufferAsString, getOutputBufferAsStringArray, getOutputBufferContents, getParent, getProperties, getProperty, getPropertyChangeListeners, getPropertyConnectionManager, getSleepTime, getSourceBufferConnections, getState, getTraceLogger, hasInputBuffer, hasOutputBuffer, isAbleEventPostingEnabled, isAbleEventProcessingEnabled, isChanged, isConnectable, isDataFlowEnabled, isTimerEventProcessingEnabled, notifyAbleEventListeners, process, processBufferConnections, processNoEventProcessingEnabledSituation, removeAbleEventListener, removeAllAbleEventListeners, removeAllBufferConnections, removeAllPropertyConnections, removeDestBufferConnection, removeProperty, removePropertyChangeListener, removePropertyConnection, removeSourceBufferConnection, removeStateChangeListener, restartEnabledEventProcessing, restoreFromFile, restoreFromFile, restoreFromSerializedFile, restoreFromStream, resumeEnabledEventProcessing, saveToFile, saveToFile, setAbleEventProcessingEnabled, setChanged, setComment, setFileName, setInputBuffer, setInputBuffer, setLogger, setName, setOutputBuffer, setOutputBuffer, setParent, setProperties, setProperty, setSleepTime, setState, setTimerEventProcessingEnabled, setTraceLogger, sourceConnectionsOK, startEnabledEventProcessing, suspendEnabledEventProcessing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.able.AbleRemoteAgent
addEventConnection, getAgentAddr, getAgentHost, getAgentName, getDataSource, isActiveDataSource, removeEventConnection, setActiveDataSource
 
Methods inherited from interface com.ibm.able.AbleRemoteBean
getName, getProperties, getProperty, getState, init, process, quitAll, removeProperty, resumeAll, setProperties, setProperty, suspendAll
 
Methods inherited from interface com.ibm.able.AbleRemoteEventListener
handleAbleEvent
 
Methods inherited from interface com.ibm.able.AbleEventListenerRemoteManager
addAbleEventListener, notifyAbleEventListeners, removeAbleEventListener
 
Methods inherited from interface com.ibm.able.AbleEventQueueRemoteManager
flushAbleEventQueue, getAbleEventProcessingEnabled, getAbleEventQueueSize, getSleepTime, isTimerEventProcessingEnabled, quitEnabledEventProcessing, restartEnabledEventProcessing, resumeEnabledEventProcessing, setAbleEventProcessingEnabled, setSleepTime, setTimerEventProcessingEnabled, startEnabledEventProcessing, suspendEnabledEventProcessing
 
Methods inherited from interface com.ibm.able.AbleBeanRemoteContainer
addBean, containsBean, containsBean, getBean, getBeans, removeAllBeans, removeBean, removeBean
 
Methods inherited from interface com.ibm.able.AbleUserDefinedFunctionRemoteManager
addUserDefinedFunction, containsUserDefinedFunction, getUserDefinedFunction, getUserDefinedFunctions, invokeUserDefinedFunction, removeUserDefinedFunction, setUserDefinedFunctions
 
Methods inherited from interface com.ibm.able.AbleBean
getComment, getLogger, getName, getParent, getProperties, getProperty, getState, getTraceLogger, isChanged, process, removeProperty, setChanged, setComment, setLogger, setName, setParent, setProperties, setProperty, setState, setTraceLogger
 
Methods inherited from interface com.ibm.able.AbleDataBufferManager
addDestBufferConnection, addSourceBufferConnection, getDestBufferConnections, getInputBuffer, getInputBuffer, getInputBufferAsString, getInputBufferAsStringArray, getInputBufferContents, getOutputBuffer, getOutputBuffer, getOutputBufferAsString, getOutputBufferAsStringArray, getOutputBufferContents, getSourceBufferConnections, hasInputBuffer, hasOutputBuffer, isConnectable, isDataFlowEnabled, processBufferConnections, removeAllBufferConnections, removeDestBufferConnection, removeSourceBufferConnection, setInputBuffer, setInputBuffer, setOutputBuffer, setOutputBuffer
 
Methods inherited from interface com.ibm.able.AbleEventListenerManager
addAbleEventListener, dataChanged, getAbleEventListeners, notifyAbleEventListeners, removeAbleEventListener
 
Methods inherited from interface com.ibm.able.AbleEventQueueManager
flushAbleEventQueue, getAbleEventProcessingEnabled, getAbleEventQueueSize, getSleepTime, isAbleEventPostingEnabled, isAbleEventProcessingEnabled, isTimerEventProcessingEnabled, restartEnabledEventProcessing, resumeEnabledEventProcessing, setAbleEventProcessingEnabled, setSleepTime, setTimerEventProcessingEnabled, startEnabledEventProcessing, suspendEnabledEventProcessing
 
Methods inherited from interface com.ibm.able.AbleEventQueueProcessor
processNoEventProcessingEnabledSituation
 
Methods inherited from interface com.ibm.able.AblePropertyChangeManager
addPropertyChangeListener, addPropertyConnection, getPropertyChangeListeners, getPropertyConnectionManager, removeAllPropertyConnections, removePropertyChangeListener, removePropertyConnection
 
Methods inherited from interface com.ibm.able.AbleSerializable
getFileName, restoreFromFile, restoreFromFile, saveToFile, saveToFile, setFileName
 
Methods inherited from interface com.ibm.able.AbleBeanContainer
getName
 

Field Detail

masterController

protected AutotuneController masterController
The controller that gets called each time the autotune agent is processed.


metricManager

protected AutotuneMetricManager metricManager
A registry of all metrics available for use in this agent.


controllerRate

protected int controllerRate
The rate at which the agent's masterController is processed; in milliseconds.


synchronousAdaptorMode

protected boolean synchronousAdaptorMode
A boolean indicating whether or not adaptors collect their data synchronously when this agent is prcoessed. If synchnrous, all adaptor beans are processed before the masterController is processed.


defaultAdaptorRate

protected int defaultAdaptorRate
The rate in milliseconds at which the agent's masterController is processed.


dataRepositoryPath

protected java.lang.String dataRepositoryPath
The base directory used to store logging data.


remoteAgent

protected AutotuneAgentIf remoteAgent
The remote agent (if connected via customizer)


dataBean

protected AutotuneDataBean dataBean
Holder for data to be shipped between remote agent and client agent

Constructor Detail

AutotuneAgent

public AutotuneAgent()
              throws AbleException,
                     java.rmi.RemoteException

AutotuneAgent

public AutotuneAgent(java.lang.String aName)
              throws AbleException,
                     java.rmi.RemoteException
Method Detail

setSynchronousAdaptorMode

public void setSynchronousAdaptorMode(boolean state)
                               throws AbleException
Set the flag used to determine whether to process each adaptor before processing the masterController.

Specified by:
setSynchronousAdaptorMode in interface AutotuneAgentIf
Throws:
AbleException

isSynchronousAdaptorMode

public boolean isSynchronousAdaptorMode()
                                 throws AbleException
Return the flag indicating whether adaptors are to be processed synchronously.

Specified by:
isSynchronousAdaptorMode in interface AutotuneAgentIf
Throws:
AbleException

setControllerRate

public void setControllerRate(int rate)
                       throws AbleException
Set the time period between processing the masterController.

Specified by:
setControllerRate in interface AutotuneAgentIf
Throws:
AbleException

getControllerRate

public int getControllerRate()
                      throws AbleException
Return the time period between processing the masterController.

Specified by:
getControllerRate in interface AutotuneAgentIf
Throws:
AbleException

setDefaultAdaptorRate

public void setDefaultAdaptorRate(int rate)
                           throws AbleException
Specified by:
setDefaultAdaptorRate in interface AutotuneAgentIf
Throws:
AbleException

getDefaultAdaptorRate

public int getDefaultAdaptorRate()
                          throws AbleException
Specified by:
getDefaultAdaptorRate in interface AutotuneAgentIf
Throws:
AbleException

setDataRepositoryPath

public void setDataRepositoryPath(java.lang.String path)
                           throws AbleException
Set the base directory used to store logging data.

Specified by:
setDataRepositoryPath in interface AutotuneAgentIf
Throws:
AbleException

getDataRepositoryPath

public java.lang.String getDataRepositoryPath()
                                       throws AbleException
Get the base directory used to store logging data.

Specified by:
getDataRepositoryPath in interface AutotuneAgentIf
Throws:
AbleException

getMasterController

public AutotuneController getMasterController()
                                       throws AbleException
Return the controller serving as masterController in this agent.

Specified by:
getMasterController in interface AutotuneAgentIf
Throws:
AbleException

setMasterController

public void setMasterController(AutotuneController controller)
                         throws AbleException
Select which controller should be master.

Specified by:
setMasterController in interface AutotuneAgentIf
Throws:
AbleException

setMasterController

public boolean setMasterController(java.lang.String theName)
                            throws AbleException
Set the master controller using its name.

Specified by:
setMasterController in interface AutotuneAgentIf
Parameters:
theName - A String containing the name of the controller.
Returns:
A boolean indicating whether the controller was found and set.
Throws:
AbleException

getMetrics

public AutotuneMetricCollection getMetrics()
                                    throws AbleException
Get all metrics defined by all adaptors in this agent.

Specified by:
getMetrics in interface AutotuneAgentIf
Throws:
AbleException

getLoggingMetrics

public AutotuneMetricCollection getLoggingMetrics()
                                           throws AbleException
Get the collection of selected metrics for logging.

Specified by:
getLoggingMetrics in interface AutotuneAgentIf
Throws:
AbleException

setLoggingMetrics

public void setLoggingMetrics(AutotuneMetricCollection loggingMetrics)
                       throws AbleException
Set the collection of selected metrics for logging.

Specified by:
setLoggingMetrics in interface AutotuneAgentIf
Throws:
AbleException

getMetric

public AutotuneMetric getMetric(java.lang.String metricName)
                         throws AbleException
Return the metric with the specified name.

Specified by:
getMetric in interface AutotuneAgentIf
Throws:
AbleException

setLogData

public void setLogData(boolean state)
                throws AbleException
Turn logging on or off.

Specified by:
setLogData in interface AutotuneAgentIf
Throws:
AbleException

getLogData

public boolean getLogData()
                   throws AbleException
Return whether logging is on or off.

Specified by:
getLogData in interface AutotuneAgentIf
Throws:
AbleException

isLogData

public boolean isLogData()
                  throws AbleException
Return whether logging is on or off.

Specified by:
isLogData in interface AutotuneAgentIf
Throws:
AbleException

setLogDataFileName

public void setLogDataFileName(java.lang.String fileName)
                        throws AbleException
Set the name of the file used to write log data.

Specified by:
setLogDataFileName in interface AutotuneAgentIf
Throws:
AbleException

getLogDataFileName

public java.lang.String getLogDataFileName()
                                    throws AbleException
Get the name of the file where log data is written.

Specified by:
getLogDataFileName in interface AutotuneAgentIf
Throws:
AbleException

process

public void process()
             throws AbleException
Check the current state of the target system if the adaptor mode is synchronous by processing each adaptor. Process the masterController to see if we need to take any control actions and then take them. Write any log data if logging is enabled.

Specified by:
process in interface AbleRemoteBean
Overrides:
process in class AbleDefaultAgent
Throws:
AbleException - If an error occurs. Errors from each contained bean are accumulated.
See Also:
writeLogData()

processTimerEvent

public void processTimerEvent()
                       throws AbleException
Current behavior is to simply call the process() method. This is called whenever the agent't timer expires.

Specified by:
processTimerEvent in interface AbleEventQueueProcessor
Overrides:
processTimerEvent in class AbleObject
Throws:
AbleException - If an error occurs.
See Also:
process()

processAbleEvent

public void processAbleEvent(AbleEvent theAbleEvent)
                      throws AbleException
Process an Able event synchronously; that is, on the same thread as the caller.

Note that the exceptions IllegalAccess, InvocationTarget, NoSuchMethod, and Security are all caught here, so that this method simply returns to the caller with no error indication. If logging is in effect, the exceptions are logged.

Specified by:
processAbleEvent in interface AbleEventQueueProcessor
Overrides:
processAbleEvent in class AbleObject
Parameters:
theAbleEvent - The event to process.

Throws:
AbleException - If an error occurs.
See Also:
AbleObject.setAbleEventProcessingEnabled(int), AbleObject.startEnabledEventProcessing(), AbleDefaultAgent.handleAbleEvent(AbleEvent)

writeLogData

public void writeLogData()
                  throws AbleException
Write system state and control actions to log file for post mortem analysis, and replay if desired.

Specified by:
writeLogData in interface AutotuneAgentIf
Throws:
AbleException

reset

public void reset()
           throws AbleException
Restore processing options to default values.

Specified by:
reset in interface AbleRemoteBean
Overrides:
reset in class AbleDefaultAgent
Throws:
AbleException - If an error occurs when resetting a contained bean. All errors are collected and insert into the exception so that one bean's error does not prevent another from being reset.

init

public void init()
          throws AbleException
Initialize the autotune agent.

Note: All adaptors and controllers should already be in the agent/ The initialization steps are:

  1. initialize all adaptors
  2. initialize the metric manager (load metric info from all adaptors)
  3. initialize all controllers (ask the metric manager for metric data)

Specified by:
init in interface AbleRemoteBean
Overrides:
init in class AbleRemoteDefaultAgent
Throws:
AbleException - If an error occurs.
See Also:
AbleObject.init()

getAdaptors

public java.util.Vector getAdaptors()
                             throws AbleException
Return all beans which are AutotuneAdaptors.

Specified by:
getAdaptors in interface AutotuneAgentIf
Returns:
A Vector of AutotuneAdaptor objects.
Throws:
AbleException

getControllers

public java.util.Vector getControllers()
                                throws AbleException
Return all beans which are AutotuneControllers.

Specified by:
getControllers in interface AutotuneAgentIf
Returns:
A Vector of AutotuneController objects.
Throws:
AbleException

setRemoteAgent

public void setRemoteAgent(AutotuneAgentIf theRemoteAgent)
Set the remote agent reference

Specified by:
setRemoteAgent in interface AutotuneAgentIf

getRemoteAgent

public AutotuneAgentIf getRemoteAgent()
Retrieve the remote agent reference (if any)


hasRemoteAgent

public boolean hasRemoteAgent()
Returns true if this agent is acting as a local proxy for a remote agent


setDataBean

public void setDataBean(java.lang.Object theDataBean)

getDataBean

public java.lang.Object getDataBean()

ABLE 2.3.0 07/13/2005 14:21:00

(C) Copyright IBM Corporation 1999, 2005