eWON JTK

com.ewon.ewonitf
Class RuntimeControl

java.lang.Object
  extended by com.ewon.ewonitf.RuntimeControl

public class RuntimeControl
extends Object

This static class contains some methods for controlling and monitoring the JVM behaviour in a way which is specific to the eWON.


Method Summary
static void configureAppWatchdog(int minutes)
          Configure or disable the application watchdog.
The application is checking that the refreshWatchdog() function is called at least every minutes, in case the refresh function is not called within the programmed maximum time, the eWON will reboot with a critical error.
REM: when this function is called, the watchdog timer is reset.
static void configureNextRunCommand(String runCommand)
          This function is used to schedule a new JVM execution.
static int getAutoCloseJAR()
          Returns the current AutoCloseJAR value.
static void reboot()
          This function will reboot the system immediately.
static void refreshWatchdog()
          This function must be called at regular interval if the configureAppWatchdog function has been called with a value not equal to 0.
static void setAutoCloseJAR(int autoCloseOn)
          Setting AutoCloseJAR change the JVM behaviour regarding JAR files in the classpath When a JAR file is in the classpath, the file is opened when the JVM starts and it remains open as long as the JVP is running.
static void shutdown()
          This function will perform a shutdown of the device, followed by a reboot.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setAutoCloseJAR

public static void setAutoCloseJAR(int autoCloseOn)
Setting AutoCloseJAR change the JVM behaviour regarding JAR files in the classpath When a JAR file is in the classpath, the file is opened when the JVM starts and it remains open as long as the JVP is running. This is optimized because the JAR file are accessed every time a new class object must be loaded.
Sometimes it is desirable to release the JAR (for example if you want to update it while the JVM is running). This is where the AutoCloseJAR is used. When AutoCloseJAR is set to 1 all the JAR files are closed. If the JVM while it continues to run needs to access a new class it will reopen the JAR files as needed, as soon as the class is loaded, the JAR files will be closed again (if the AutoCloseJAR is still set to 1). This is usefull but it slows down a lot the class loading process, so this option should be used only when needed. If the AutoCloseJAR flag is set back to 0 the JAR files are not immediately loaded, but they wont be unloaded the next time a class object is loaded.

Parameters:
autoCloseOn - 0 or 1 according to the value required for AutoCloseJAR.

getAutoCloseJAR

public static int getAutoCloseJAR()
Returns the current AutoCloseJAR value.

Returns:
the current AutoCloseJAR value.
See Also:
setAutoCloseJAR(int)

configureNextRunCommand

public static void configureNextRunCommand(String runCommand)
This function is used to schedule a new JVM execution. As soon as the JVM will exit (upon error or upon normal end) it will be relaunched with the given runCommand line. Example:

     //Program next execution
     RTC.configureNextRunCommand("-heapsize 1M -classpath /usr/TestEwonJDK.jar -emain TestMain");
     
     //Cancel next execution
     RTC.configureNextRunCommand(null);
 

Parameters:
runCommand - The complete JVM run command line for next scheduled JVM execution.
if null the next execution is CANCELED.

configureAppWatchdog

public static void configureAppWatchdog(int minutes)
Configure or disable the application watchdog.
The application is checking that the refreshWatchdog() function is called at least every minutes, in case the refresh function is not called within the programmed maximum time, the eWON will reboot with a critical error.
REM: when this function is called, the watchdog timer is reset.

REM: the watchdog can be enabled at JVM start time using JVM command line paramters.

Parameters:
minutes - Maxmimum number of minutes between 2 calls to the refreshWatchdog() function. If 0 then the watchdog is disabled.

refreshWatchdog

public static void refreshWatchdog()
This function must be called at regular interval if the configureAppWatchdog function has been called with a value not equal to 0. If the function is not called within the given interval, the eWON will reboot.


reboot

public static void reboot()
This function will reboot the system immediately. The operation will not perform any shutdown.


shutdown

public static void shutdown()
This function will perform a shutdown of the device, followed by a reboot.


eWON JTK

www.eWON.biz: Your Eyes Watching Over Net