|
FusionReactor API v4.0.1 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.intergral.fusionreactor.api.FRAPI
public abstract class FRAPI
This class defines the public interface to FusionReactor.
All API calls internally check whether FusionReactor is available before proceding. Storing references to objects produced by this type any longer than strictly necessary (certainly not longer than the course of a single page request) is strongly discouraged, in order to reduce the scope for memory leaks. This object itself may be stored and reused if required.
This is a factory-type class; you must not instantiate it yourself, rather use the
getInstance() method.
| Field Summary | |
|---|---|
static int |
KILL_STATUS_ALREADY_DISPOSED
Indicates this request has already been disposed of, i.e. |
static int |
KILL_STATUS_ALREADY_NOTIFIED
Indicates this request has already been notified of a kill action by some other mechanism. |
static int |
KILL_STATUS_KILLED
Indicates this request was killed. |
| Method Summary | |
|---|---|
abstract boolean |
deleteLog(String name)
Deletes a given logfile. |
abstract String |
explainKillStatus(int killStatus)
Explain a given kill result value. |
abstract long |
getAllocatedMemory()
Get the quantity of memory allocated to the JVM by the operating system. |
abstract short |
getCpuUsage()
Get the current CPU usage. |
abstract File |
getCurrentLogFolder()
Get the location of the current FusionReactor log folder. |
abstract long |
getFreeMemory()
Get the quantity of free memory available to the VM, including any not yet allocated. |
static FRAPI |
getInstance()
Get a concrete instance of the FusionReactor API, on which further calls can be made. |
abstract File |
getLogfile(String name)
Gets a File object representing the named log. |
abstract int |
getLogFileVersion()
Get a string containing the version of the log files. |
abstract long |
getNextRotationTime()
Get the next rotation time. |
abstract long |
getProbeInterval()
Gets the interval, in milliseconds, of the internal resource-gathering probes. |
abstract FusionRequestSurrogate |
getRequest(long id)
Get a request by ID. |
abstract ConfigurationSurrogate |
getRunningConfiguration()
Return a deep-clone of the currently running configuration. |
abstract FusionRequestSurrogate[] |
getRunningRequests()
Return an array containing objects representing all requests currently being tracked by FusionReactor. |
abstract com.intergral.fusionreactor.fac.scheduler.Scheduler |
getScheduler()
Gets a reference to the log rotation and FusionAnalytics Connector scheduler |
abstract long |
getStartedAt()
Returns the time in ms since EPOCH that the monitor was started at |
abstract long |
getStartTime()
Get the time in milliseconds since the epoch at which the server was started. |
abstract String |
getStartTimeString()
Get the system uptime as a date/time string of the form HH:mm:ss dd-MMM-yyyy |
abstract long |
getTotalMemory()
Get the quantity of memory availble to the JVM, including any not yet allocated to it by the JVM. |
abstract long |
getUptime()
Get the number of milliseconds since FusionReactor was last started. |
abstract long |
getUsedMemory()
Get the quantity of memory currently allocated by the JVM to Java objects. |
abstract String |
getUserCookieName()
Gets the name of the cookie used for authentication. |
abstract String |
getUserCookieValue(String role)
Gets the value of the cookie used for authentication. |
abstract boolean |
isFusionReactorRunning()
Attempt to locate FusionReactor in memory and return a boolean indicating success or failure. |
abstract boolean |
isInitialized()
Gets a boolean indicating whether FR has started up and is ready for FRAPI requests. |
abstract boolean |
isMemoryProtectionActive()
Get a boolean describing whether Crash Protection's Memory Protection feature is enabled. |
abstract boolean |
isRequestProtectionActive()
Get a boolean describing whether Crash Protection's Request Protection feature is enabled. |
abstract boolean |
isTimeoutProtectionActive()
Get a boolean describing whether Crash Protection's Timeout Protection feature is enabled. |
abstract int |
kill(long fusionRequestId,
String userTraceMarker)
Kill a running request. |
abstract void |
log(String filename,
String text)
Write an INFORMATION entry to a log file |
abstract void |
log(String filename,
String level,
String text)
Write a message to a log, with a given level. |
abstract void |
registerPlugin(com.intergral.fusionreactor.plugin.IPlugin plugin)
Registers a dynamic plugin with the system. |
abstract void |
rotateLogs()
Requests a log rotation now |
abstract boolean |
sendOsgiEventAsync(com.intergral.fusionreactor.api.event.IEvent event)
Sends an event into the OSGi (Plugin) subsystem. |
abstract com.intergral.fusionreactor.api.event.IEvent |
sendOsgiEventSync(com.intergral.fusionreactor.api.event.IEvent event,
String replyTopic,
long timeout)
Sends an event into the OSGi (Plugin) framework. |
abstract void |
setPageTimeout(int seconds)
Reset the timeout value for this page. |
abstract void |
setRequestCaptureFolder(String fullPath)
Change the location to which Request Capture will store request and response data. |
abstract void |
setRunningConfiguration(ConfigurationSurrogate configurationSurrogate)
Set the running configuration to the passed ConfigurationSurrogate. |
abstract void |
setRunningConfiguration(ConfigurationSurrogate config,
boolean restart)
Set a running configuration in the system, optionally restarting it. |
abstract void |
setVMOption(String name,
String value)
Set an option on the Java Virtual Machine |
abstract void |
subscribeOsgiEvent(String topic,
com.intergral.fusionreactor.api.event.IEventHandler handler)
Subscribes an IEventHandler within the OSGi plugin subsystem. |
abstract void |
trace(String traceString)
Attach a user trace string to this request. |
abstract void |
unsubscribeOsgiEvent(com.intergral.fusionreactor.api.event.IEventHandler handler)
Unsubscribe a given handler from the OSGi event system. |
abstract boolean |
wasShutdownCleanly()
Gets a boolean indicating whether FR was shutdown cleanly last time. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int KILL_STATUS_ALREADY_DISPOSED
public static final int KILL_STATUS_ALREADY_NOTIFIED
public static final int KILL_STATUS_KILLED
| Method Detail |
|---|
public static final FRAPI getInstance()
Get a concrete instance of the FusionReactor API, on which further calls can be made.
public abstract void trace(String traceString)
Attach a user trace string to this request. These strings are available within the FusionReactor GUI in the Request Details page, and also appear in the FusionReactor debug console.
If FusionReactor is not running, this method does nothing.
traceString - The string to be attached to this request.public abstract boolean isFusionReactorRunning()
public abstract void setPageTimeout(int seconds)
Reset the timeout value for this page. If Timeout Protection is not active within FusionReactor, calls to this method have no effect. If Timeout Protection is active, the value passed to this method overrides the value configured in FusionReactor.
If FusionReactor is not running, this method does nothing.
seconds - the timeout in seconds after which this page will be aborted.public abstract FusionRequestSurrogate[] getRunningRequests()
N.b. By the time your code uses the objects returned by this method, they may have completed.
FusionRequestSurrogate objects representing all
running tracked requests, or a zero-length array if FusionReactor was not detected.public abstract ConfigurationSurrogate getRunningConfiguration()
ConfigurationSurrogate object constructed as a deep-clone of the
running configuration, which may be manipulated safely.
public abstract void setRunningConfiguration(ConfigurationSurrogate configurationSurrogate)
throws ConfigurationInvalidExceptionSurrogate,
FileNotFoundException,
IOException
Set the running configuration to the passed ConfigurationSurrogate. The sequence
of actions is as follows:
configurationSurrogate - a ConfigurationSurrogate object representing the required
configuration.
ConfigurationInvalidExceptionSurrogate - if the configuration was invalid (examine the message of the exception to find
out more)
FileNotFoundException - if the system could not find the file or folder into which the configuration
should be saved
IOException - if the system encountered an IOException whilst saving the
configuration to disk.
public abstract void setRequestCaptureFolder(String fullPath)
throws ConfigurationInvalidExceptionSurrogate,
IOException
fullPath - a full path specifying a folder which exists on the system.
ConfigurationInvalidExceptionSurrogate - with a descriptive message, if FusionReactor could not adopt the new
configuration.
IOException - if FusionReactor could not open write a new configuration prior to adopting it.
public abstract int kill(long fusionRequestId,
String userTraceMarker)
fusionRequestId - the ID of the request which is to be killeduserTraceMarker - if non-null and not an empty string, this trace marker will be stored with the
request.
KILL_STATUS_* set of enumerations
defined in this type.public abstract String explainKillStatus(int killStatus)
killStatus - the status to be explained.
public abstract long getFreeMemory()
OutOfMemoryError. This value is commonly influenced using the
-Xmx JVM parameter.
long representing the quantity of unused memory in bytes.public abstract long getTotalMemory()
Get the quantity of memory availble to the JVM, including any not yet allocated to it by the
JVM. This value is commonly influenced using the -Xmx JVM parameter.
long representing the total quantity of memory available to the JVM in
bytes.public abstract long getUsedMemory()
long representing the total quantity of memory allocated to Java
objects in bytes.public abstract long getAllocatedMemory()
public abstract short getCpuUsage()
Get the current CPU usage.
short describing the JVMs processor occupancy in percent, accross all
cores. If CPU sampling is not supported on this platform, -1 is returned.public abstract long getStartTime()
public abstract String getStartTimeString()
HH:mm:ss dd-MMM-yyyy
public abstract long getUptime()
public abstract boolean isRequestProtectionActive()
public abstract boolean isTimeoutProtectionActive()
public abstract boolean isMemoryProtectionActive()
public abstract int getLogFileVersion()
public abstract FusionRequestSurrogate getRequest(long id)
id - the ID of the request being sought.
FusionRequestSurrogate if the request could be located in the running
request map, or the history list. If not, null is returned.
public abstract void log(String filename,
String level,
String text)
filename - filename of the log to write tolevel - one of INFO, WARN or SEVERE. null means a log level will not be writtentext - text entry to write to the log
public abstract void log(String filename,
String text)
Write an INFORMATION entry to a log file
filename - filename of the log to write totext - text entry to write to the log
public abstract void setVMOption(String name,
String value)
Set an option on the Java Virtual Machine
name - name of the option to setvalue - value for the optionpublic abstract long getStartedAt()
Returns the time in ms since EPOCH that the monitor was started at
public abstract void rotateLogs()
Requests a log rotation now
public abstract void registerPlugin(com.intergral.fusionreactor.plugin.IPlugin plugin)
plugin - the plugin to register.public abstract com.intergral.fusionreactor.fac.scheduler.Scheduler getScheduler()
Scheduler from where log rotations and FusionAnalytics Connector can be
triggered.public abstract long getProbeInterval()
public abstract File getCurrentLogFolder()
public abstract long getNextRotationTime()
-1 if the rotation task is not active (log engine is in legacy
mode) or has stopped.public abstract String getUserCookieName()
public abstract String getUserCookieValue(String role)
role - the role for which a cookie is required, one of "Administrator", "Manager" or
"Observer"
public abstract boolean isInitialized()
public abstract boolean wasShutdownCleanly()
true if the system was shutdown cleanly, otherwise false.public abstract File getLogfile(String name)
File object representing the named log.
name - the named of the log for which a file is required
File representing the named log (which may not exist yet)public abstract boolean deleteLog(String name)
name - the name of the log being deleted.
true if the log was deleted, otherwise false.public abstract boolean sendOsgiEventAsync(com.intergral.fusionreactor.api.event.IEvent event)
If no Event Admin service was available in the OSGi framework, the method returns
false.
event - the event to be placed on the OSGi event bus.
true if the event was sent.
public abstract com.intergral.fusionreactor.api.event.IEvent sendOsgiEventSync(com.intergral.fusionreactor.api.event.IEvent event,
String replyTopic,
long timeout)
timeout milliseconds.
Any bundle may generate the reply event. If more than one reply event is sent by a bundle, the first one is used.
Although the method is able to wait indefinitely for a reply, this is strongly discouraged since OSGi bundles can be removed and restarted with no notice.
event - the event to be placed on the OSGi event bus.replyTopic - the topic of the event to be waited for in replytimeout - a timeout value in milliseconds. If no reply is received after this timeout,
null is returned. -1 signifies the method should wait
indefinitely.
public abstract void subscribeOsgiEvent(String topic,
com.intergral.fusionreactor.api.event.IEventHandler handler)
IEventHandler within the OSGi plugin subsystem. Whenever a topic is
raised with the given passed string, the event handler is called.
Any bundle may generate the given event. The passed topic may conform to any valid OSGi topic string, i.e. may contain a single trailing wildcard.
If no Event Admin service was available in the OSGi framework, no events will be raised.
topic - the topic being subscribed to.handler - an IEventHandler capable of receiving events.public abstract void unsubscribeOsgiEvent(com.intergral.fusionreactor.api.event.IEventHandler handler)
If the given handler is not actually subscribed to any events, the method returns immediately.
handler - the handler being unsubscribed.
public abstract void setRunningConfiguration(ConfigurationSurrogate config,
boolean restart)
throws ConfigurationInvalidExceptionSurrogate,
FileNotFoundException,
IOException
true as the second parameter.
config - the configuration to be set.restart - causes the system to restart.
IOException
ConfigurationInvalidExceptionSurrogate - if the configuration was invalid (examine the message of the exception to find
out more)
FileNotFoundException - if the system could not find the file or folder into which the configuration
should be saved
IOException - if the system encountered an IOException whilst saving the
configuration to disk.
|
FusionReactor API v4.0.1 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||