public class Controller
extends java.lang.Object
For most purposes, use the TaskController directly.
Controller itself only provides logging abilities available at the object level, rather than just the system level. It only retains the logs generated within the Controllers themselves, not the general logging done by other objects in the system.
This allows not only logging the control information, but also retrieving it for use by the controlling Java code. The information may then be displayed in its own manner.
TaskController
,
ProcessController
Modifier and Type | Class and Description |
---|---|
static class |
Controller.ControllerException
ControllerException
This exception is thrown for controller errors.
|
static class |
Controller.LogElement
LogElement
The object log is composed of LogElements.
|
static class |
Controller.LogLevel
LogLevel enumeration supported by Controller logging.
|
Modifier and Type | Field and Description |
---|---|
protected long |
defaultDuration |
protected java.util.concurrent.TimeUnit |
defaultTimeUnit |
protected java.util.List<Controller.LogElement> |
log |
protected static Logger |
LOG |
protected Controller.LogLevel |
logLevel |
protected boolean |
logToLogger |
protected com.appiancorp.common.performance.Performance |
performance |
protected ServiceContext |
sc |
Constructor and Description |
---|
Controller(ServiceContext sc)
Construct an Controller for the given ServiceContext.
|
Modifier and Type | Method and Description |
---|---|
void |
clearLog()
Clear the retrievable log.
|
void |
enableLogToLogger(boolean state)
Set whether logging should be done to the logger (Log4J) as well as recorded.
|
void |
enablePerformanceLogging(boolean state)
Enable or disable performance logging, regardless of logging settings.
|
Controller.LogElement[] |
getLog() |
java.lang.String |
getPerformanceSummary()
Get a textual performance summary.
|
protected void |
log(Controller.LogLevel logLevel,
java.lang.String message)
Record the log messages in this Controller's log and send it to the
external (e.g., log4j) logger.
|
void |
setLogLevel(Controller.LogLevel logLevel)
Set desired logging level.
|
void |
setTimeout(long duration,
java.util.concurrent.TimeUnit timeUnit)
Set default timeout duration for Controller methods, if explicit duration and timeUnit parameters are not passed to a method.
|
protected void |
yield(long duration,
java.util.concurrent.TimeUnit timeUnit,
java.lang.String message)
Yield for the given time, logging a delay message at LogLevel.INFO.
|
protected static final Logger LOG
protected final com.appiancorp.common.performance.Performance performance
protected ServiceContext sc
protected java.util.List<Controller.LogElement> log
protected Controller.LogLevel logLevel
protected boolean logToLogger
protected long defaultDuration
protected java.util.concurrent.TimeUnit defaultTimeUnit
public Controller(ServiceContext sc)
sc
- activityId
- public void setTimeout(long duration, java.util.concurrent.TimeUnit timeUnit)
duration
- timeUnit
- public void setLogLevel(Controller.LogLevel logLevel)
logLevel
- public void enableLogToLogger(boolean state)
state
- true to log controller messages to logger; true by defaultpublic void clearLog()
protected void log(Controller.LogLevel logLevel, java.lang.String message)
logLevel
- of the message; this is compared against the
Controller's log level to see if the log should be done.message
- the textual log messagepublic Controller.LogElement[] getLog()
public java.lang.String getPerformanceSummary()
log4j.logger.perf.controller=INFO, EXPRESSION_PERF
public void enablePerformanceLogging(boolean state)
state
- true to enable, false to disableprotected void yield(long duration, java.util.concurrent.TimeUnit timeUnit, java.lang.String message)
duration
- time in timeUnitstimeUnit
- meaning of timeUnitmessage
- to include in log messageCopyright © 2003-2024 Appian Corporation. All Rights Reserved.