Page History
...
A user-defined startup class can be specified by the 'startup.class' property in the manager.properties file.
startup.class=com.acme.MyStartup...
The internal startup class and the user-defined startup class run before the JSM starts to accept client and console connections.
Example 1
...
package com.acme ;
...
public final class MyStartup implements Runnable
...
{
public void run ()
...
{
try
{
/* YOUR CODE GOES HERE */
...
}
catch ( Throwable t )
...
{
t.printStackTrace () ;
...
}
}
}
Example 2
...
package com.acme ;
...
public final class MyStartup implements Runnable
...
{
private int m_sleepTime = 0 ;
...
public MyStartup ()
...
{
/*
JSMManager uses the zero argument constructor
...
*/
...
int seconds = 60 * 20 ; // Every 20 minutes
...
Thread thread = new Thread ( new MyStartup ( seconds ) ) ;
...
thread.start () ;
...
}
public MyStartup ( int seconds )
...
{
/*
Specify sleep time
...
*/
...
if ( seconds <= 0 )
...
{
seconds = 0 ;
...
}
...
m_sleepTime = seconds * 1000 ;
...
}
...
public void run ()
...
{
if ( m_sleepTime == 0 )
...
{
/*
JSMManager call
...
*/
...
System.out.println ( "JSM warmup call" ) ;
...
try
...
{
...
warmup () ;
...
}
catch ( Throwable t )
...
{
t.printStackTrace () ;
...
}
return ;
...
}
/*
...
MyStartup call with sleep time
...
*/
...
while ( true )
...
{
try
{
Thread.sleep ( m_sleepTime ) ;
...
System.out.println ( "MyStartup repeat warmup call" ) ;
...
warmup () ;
...
}
catch ( Throwable t )
...
{
t.printStackTrace () ;
...
}
}
}
private final void warmup () throws Exception
...
{
System.out.println ( "MyStartup warmup" ) ;
...
/* YOUR CODE GOES HERE */
...
}
...
}