jaxx.runtime.swing.application
Class ApplicationRunner

java.lang.Object
  extended by jaxx.runtime.swing.application.ApplicationRunner

public abstract class ApplicationRunner
extends Object

Simple application runner which authorize to reload an application.

Since:
2.1
Author:
tchemit

Field Summary
protected  String[] args
          arguments given to runner at launch time
protected  Exception error
           
protected  Thread mainThread
           
protected  boolean reload
          flag to reload the runner when closing it
protected  Runnable runnable
          the runner to start application
protected  long startingTime
           
 
Constructor Summary
protected ApplicationRunner(String[] args)
           
 
Method Summary
 void close()
           
static ApplicationRunner getRunner()
           
protected abstract  void initOnce()
          To execute some code only once.
 boolean isReload()
           
 void launch()
           
static void lock()
           
protected abstract  void onClose(boolean reload)
          Hook to close runner.
protected abstract  void onError(Exception e)
          Hook when an error occurs in runner.
protected abstract  void onInit()
          Hook to init runner.
protected abstract  void onShutdown()
          Hook to shutdown launcher
protected abstract  void onShutdown(Exception ex)
          Hook to shutdown launcher when an exception occurs on clsoing.
protected abstract  void onStart()
          Hook to start runner.
 void setReload(boolean reload)
           
static void unlock()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

args

protected final String[] args
arguments given to runner at launch time


reload

protected boolean reload
flag to reload the runner when closing it


runnable

protected final Runnable runnable
the runner to start application


startingTime

protected long startingTime

error

protected Exception error

mainThread

protected Thread mainThread
Constructor Detail

ApplicationRunner

protected ApplicationRunner(String[] args)
Method Detail

getRunner

public static ApplicationRunner getRunner()

lock

public static void lock()
                 throws InterruptedException
Throws:
InterruptedException

unlock

public static void unlock()

initOnce

protected abstract void initOnce()
To execute some code only once.

This code will not be re-execute when reloading the runner.


onInit

protected abstract void onInit()
                        throws Exception
Hook to init runner.

Throws:
Exception - if any problem

onStart

protected abstract void onStart()
                         throws Exception
Hook to start runner.

Throws:
Exception - if any problem

onClose

protected abstract void onClose(boolean reload)
                         throws Exception
Hook to close runner.

Parameters:
reload - if reload was asked
Throws:
Exception - if any problme

onShutdown

protected abstract void onShutdown()
                            throws Exception
Hook to shutdown launcher

Throws:
Exception - if any problem

onShutdown

protected abstract void onShutdown(Exception ex)
Hook to shutdown launcher when an exception occurs on clsoing.

Parameters:
ex - the error catched while closing launcher

onError

protected abstract void onError(Exception e)
Hook when an error occurs in runner.

Parameters:
e - the error catched

isReload

public boolean isReload()

setReload

public void setReload(boolean reload)

launch

public final void launch()

close

public final void close()


Copyright © 2008-2011 CodeLutin. All Rights Reserved.