public class Avalon
extends java.lang.Object
implements java.lang.Runnable
Property Keyword | Datatype | Default | Description |
---|---|---|---|
Properties | String | null | A file containing Avalon properties. Properties that additionally added at command line have higher priority than these from file. This value is an application property. |
NameServiceName | String | NameService | The name of the requested CORBA Name Service. This value is an application property. It is ignored if ORBInitRef is set. |
NameServicePort | String | 900 | The port number of the requested CORBA Name Service. This value is an application property. It is ignored if ORBInitRef is set. |
NameServiceHost | String | localhost | The host name of the requested CORBA Name Service. This value is an application property. It is ignored if ORBInitRef is set. |
CORBAProtocol | String | "" | The CORBA protocol in the corbaloc (CORBA locator) to find the name
service. The default of CORBA is iiop, which is identical with an empty string "". For IIOP over SSL the protocol must be ssliop. This value is an application property. It is ignored if ORBInitRef is set. |
ORBInitRef | String | none | The full corbaloc (CORBA locator). If this value is set, the values of NameServiceName, NameServicePort, NameServiceHost and CORBAProtocol are ignored. This value is an application property. Example: NameService=corbaloc::1.2@MyServiceHost:MyServicePort/NameService |
NotificationServicePort | String | None | The port number of the requested CORBA Notification Service. When this
property is set a second ORBInitRef to resolve initial reference of the CORBA
Notification Service is given to the ORB. This value is an application property. It is ignored if ORBInitRef is set. |
NotificationServiceName | String | NotificationService | The name of the requested CORBA Notification Service. This value is an application property. It is used if NotificationServicePort is set. It is ignored if ORBInitRef is set. |
NotificationServiceHost | String | the setting property of NameServiceHost | The host name of the requested CORBA Notification Service. This value is an application property. It is used if NotificationServicePort is set. It is ignored if ORBInitRef is set. |
ORBProperty | String | null | An ORB property. The property name of the property is defined in the
brackets. Example: ORBProperty[com.sun.CORBA.codeset.charsets]=0x05010001, 0x00010109 ORBProperty[com.sun.CORBA.codeset.wcharsets]=0x00010109, 0x05010001 |
ServiceName | String | First Service in INI file. | The service to be used by Avalon. This value is an application property. |
ServiceOptions | String | INIFILE=ATHOS_INI | Implementation dependent options passed to the service factory when the service is instantiated. This value is an application property. |
SessionFactoryOptions | String | none | Implementation dependent options passed to the session factory when the session factory is instantiated. This option could contain something like "DEBUGLEVEL=3". This value is an application property. |
Any options supported by the CORBA implementation | String | none | Implementation dependent options passed to the CORBA implementation when the ORB is instantiated. This option could contain something like "jacorb.verbosity=0". This value is an application property. |
Avalon.SessionWatchdogCount | int | 3 | This value tells the Avalon server how many time periods a session can be
inactive, before the session will be closed by the server. The time period,
is hardcode, is 10 min (WATCHDOG_SLEEP_TIME) between two checks. When the client closes the session correct this value has no influence on the server behavior only died session clients or the long inactive clients will be closed. |
Avalon.StartResourceMonitor | boolean | false | This flags tells the server to start the resource monitor at start time. |
Avalon.PrintNameServiceIOR | boolean | false | This flags tells the server to print the NameService IOR to the console. This IOR can be used by the client to find the name service used by Avalon. |
Avalon.PublishInRoot | boolean | true | This flags tells the server to publish the AoFactory in the root of the name service. When the AoFactory is published in the root, the object will always have the kind ASAM-ODS. |
Avalon.NameServiceContext | string | "org/asam/ods/" | This property set the name service context. The name service context is the context in which servicename will be published. ASAM ODS defines the context org/asam/ods/, which is the default. The context must ends with '/' character. |
Avalon.NameServiceContextKind | string | "" | This property set the kind of the object published at the name service. The kind of the name of the AoFatocry published name service context. This property has no influence on the kind of the name of the AoFactory published in the root of the name service. |
Avalon.IniFile | string | "ATHOS_INI" | Use this property to set an INI file for the server. The default is the file defined by the environment ATHOS_INI. |
Avalon.DebugLevel | int | 0 | To get verbose output set this value. Currently there is no convention at
what is printed at what level. Information about the reported informaiton on
debug level: <br> > 0
|
Avalon.RestartAt | String | none | A cron like string value that defines the moment when to restart there
server.
It is possible to assign more than one value per field, the values must be separated by a colon (,). A star (*) means all allowed values and a minus (-) defined a range. 0,30 17 * * 1-5 At every day from Monday to Friday (1-5) at 17:00 and 17:30 every week in the year. 59 23 * * 6 At every Saturday in the week at 23:59. |
Avalon.LDAPClass.Name | String | none | The name of the class for the LDAP access to check the authentication with an LDAP server. @see com.highqsoft.avalon.LDAPCheckInterface |
Avalon.LDAPClass.Options | String | none | The option string for the constructor for the LDAP access to check the authentication with an LDAP server. |
Avalon.StdOut | File | none | The name of a file that Avalon uses as standard output stream. This property cannot be set via the file passed with -Properties option. |
Avalon.StdErr | File | none | The name of a file that Avalon uses as standard error stream. This property cannot be set via the file passed with -Properties option. |
Avalon.SourceClassName | String | com.highqsoft.avalon.AoService | The name of class which implement the interface com.highqsoft.ods.AoService which is the entry point of the implementation. |
Avalon.StartControl | String | NO | Start the avalon control factory. When this property has the value 'NO'
no AvalonCrontrolFactory is strated. When this property has the value
'NameService' the AvalonControlFactory will be published at the CORBA
NameService. When this property has any other value, this value will be used
as filename to store the IOR of the AvalonControlFactory. The
AvalonControlFactory implements the interface |
Avalon.NewSessionClass.Name | String | none | The name of the class for the check of the session after the session is
created. The class must be of the interface
com.highqsoft.avalon.SessionCheckInterface or
com.highqsoft.avalon.SessionCheckInterfaceEnhanced.
|
Avalon.NewSessionClass.Options | String | none | The option string for the constructor for the new session class. |
Avalon.SessionCloseClass.Name | String | none | The name of the class for the check of the session before the
session is closed. The class must be of the interface
com.highqsoft.avalon.SessionCheckInterface or
com.highqsoft.avalon.SessionCheckInterfaceEnhanced.,
|
Avalon.SessionCloseClass.Options | String | none | The option string for the constructor for the session close class. |
Avalon.SessionWillCloseClass.Name | String | none | The name of the class for the check of the session that will be closed by the Avalon the next check period when no activity is on the session. The class must be of the interface com.highqsoft.avalon.SessionCheckInterface or com.highqsoft.avalon.SessionCheckInterfaceEnhanced. |
Avalon.SessionWillCloseClass.Options | String | none | The option string for the constructor for the session close class. |
Avalon.NotificationPluginClass.Name | String | none | The name of the class for the notification plugin. @see com.highqsoft.avalon.AvalonNotificationListener |
Avalon.LogHandlerClass.Name | String | none | The name of the class for the log handler plugin. It must fulfill the interface @see com.highqsoft.avalon.LogHandler It is used, if the avalon libary avalon.dll(so)) is defined as log library in INI file only. |
Avalon.WorkerMode | String | none | When value is true, then Avalon is executed in worker mode. In this case, no nameservice entry will be done and Avalon tries to connect to Avalon Distributor for retrieving session request and maybe sending notifcation and session events. |
Avalon.ConfigurationFile | String | none | The value should contain a valid Filename (with path) to the Avalon configuration file (for example: c:\avalon\etc\avalon.xml). When the parameter is not set, avalon tries to search the avalon configration file with the environment variable: AVALON_INI or in the current directory with the name avalon.xml. |
Avalon.Name | String | none | The optional value contains the name of the Avalon instance. When
Avalon runs in worker mode, it creates a context variable with the name
'ODS_LOGFILE_ |
Avalon.SessionWatchdogSleep | int | 10 | This value in minutes lets the Avalon server to controls the watchdog cycle interval, the value could be maximal 10 and minimal 1. |
Avalon.CleanupObjectEnabled | boolean | true | This value as boolean tells the Avalon server if the cleanup operation will be performed when the number of session objects exceed CleanupObjectHeap. |
Avalon.CleanupObjectLeasing | int | SessionWatchdogCount * SessionWatchdogSleep | This value as minutes lets the Avalon server to control which objects are marked as expired, so that the objects are marked as expired when its last modification is older then the leasing time. |
Avalon.CleanupObjectHeap | int | 100.000 | This value as number lets the Avalon server to control the threshold when the cleanup operation is done. When the number of objects in the session is bigger than the given value, the cleanup operation will be performed if enabled. |
Modifier and Type | Class and Description |
---|---|
class |
Avalon.AvalonSessionWatchdogThread
The session watchdog, this thread checks the session if they are used,
when the session is used for longer time period the session will be
closes.
|
protected class |
Avalon.Restarter
The restarter class used when the Avalon.RestartAt property is available.
|
protected static class |
Avalon.RunningStateListener
The service listener to control the state of the command line ver
|
Modifier and Type | Field and Description |
---|---|
protected java.lang.String[] |
args |
protected AvalonConfigurationService |
avalonConfiguration |
static java.lang.String |
CONTROL_FACTORY_KIND |
static java.lang.String |
CONTROL_FACTORY_PATH |
static java.lang.String |
DEFAULT_CORBA_IMPLEMENTATION |
static java.lang.String |
DEFAULT_CORBA_PROTOCOL |
static java.lang.String |
DEFAULT_NAME_SERVICE_NAME |
static java.lang.String |
DEFAULT_NAME_SERVICE_PORT |
static java.lang.String |
DEFAULT_NOTIFICATION_SERVICE_NAME |
protected static int |
DEFAULT_OBJECT_HEAP |
static java.lang.String |
DEFAULT_VERSION |
protected static int |
DEFAULT_WATCHDOG_COUNT |
protected static int |
DEFAULT_WATCHDOG_SLEEP |
protected static java.lang.String |
hostname |
static java.lang.String |
HOSTNAME
The hostname.
|
protected static java.lang.String |
loadLibName |
static long |
PROCESS
The process id.
|
protected java.util.Properties |
properties |
static java.lang.String |
PROPERTY_NAME_AVALONWORKERID |
static java.lang.String |
PROPERTY_NAME_DISTRIBUTOR
constants for passing values to plugin:
DistributorCorbaNotificationServicePlugin
|
static java.io.PrintStream |
STDERR
The JAVA standard error stream.
|
static java.io.InputStream |
STDIN
The JAVA standard error stream.
|
static java.io.PrintStream |
STDOUT
The JAVA standard output stream.
|
static java.lang.String |
version |
Constructor and Description |
---|
Avalon() |
Avalon(java.lang.String[] args) |
Modifier and Type | Method and Description |
---|---|
void |
addJVMServiceListener(JVMServiceListener l)
Add a service state listener.
|
void |
addSession(AoSession aosObj)
Add the session to the list of running sessions.
|
void |
addSessionListener(SessionListener l)
Add a session listener.
|
static java.lang.String |
aoExceptionToString(AoException aoException)
Get the string of the AoException.
|
org.omg.CosNaming.NameComponent[] |
checkAndRebind(org.omg.CosNaming.NamingContext nsContext,
org.omg.CosNaming.NameComponent[] path,
org.omg.CORBA.Object aofRef,
boolean orbStarted)
Check the object in the name service context if the object is a valid
AoFactory object, the there is an implementation of avalon running at the
momet with the same name and the service will not start.
|
protected void |
cleanupUnusedObjects(AoSession aosObj,
int toKeepObjectCount)
Based on the configuration, scan the given session for
AvalonDestroyable which
AvalonDestroyable.lastAccessTime()() is smaller than now minus
getWatchdogCount() * WATCHDOG_SLEEP_TIME
When the number of used object exceed the AVALON threshold, destroy the
given toBeDestroyCount from the oldest objects. |
boolean |
exit()
The exit method.
|
void |
fireServiceEvent(int state)
Fire a service event.
|
void |
fireServiceEvent(int state,
java.lang.String message)
Fire a service event.
|
void |
fireServiceEvent(JVMServiceEvent ev)
Fire a service event.
|
void |
fireSessionEvent(int state,
AoSession aosObj)
Fire a session event.
|
void |
fireSessionEvent(int state,
java.lang.String message,
AoSession aosObj)
Fire a session event.
|
void |
fireSessionEvent(SessionEvent ev)
Fire a session event.
|
com.highqsoft.avalon.AvalonDistributorFactory |
getAvalonDistributorFactory()
Returns the instance of the AvalonDistributorFactory when avalon is in
worker mode
|
java.lang.String |
getAvalonWorkerId()
Returns the avalon worker id, when avalon is in worker mode
|
int |
getCleanupObjectHeap() |
long |
getCleanupObjectLeasing()
Tells the current set object leasing time in minutes.
|
static java.lang.String |
getDateTime()
Get the current date and time.
|
int |
getDebugLevel()
Get the debug level.
|
static Avalon |
getInstance()
Get the avalon instance.
|
JVMServiceListener[] |
getJVMServiceListeners()
Get all service state listeners.
|
int |
getMaxNumberOfSession()
Get the maximum number of concurrent sessions
|
int |
getNextSessionId()
Returns the next session id, when avalon is in worker mode, otherwise 0.
|
int |
getNumberOfSession()
Get the number of current session
|
org.omg.CORBA.ORB |
getOrb()
Get the ORB of the Avalon.
|
java.lang.String[] |
getOrbArguments() |
protected java.util.Properties |
getOrbProperties() |
java.lang.String |
getProperty(java.lang.String key)
Get a property.
|
boolean |
getProperty(java.lang.String key,
boolean def)
Get a property.
|
int |
getProperty(java.lang.String key,
int def)
Get a property.
|
long |
getProperty(java.lang.String key,
long def)
Get a property.
|
java.lang.String |
getProperty(java.lang.String key,
java.lang.String def)
Get a property.
|
java.lang.String |
getRunningState()
Get the running state of the avalon
|
java.lang.String |
getServiceName()
Get the name of the service of the avalon.
|
AoSession |
getSession(int sessionId)
Get the session form the avalon with the given session Id.
|
int |
getSessionCount()
Get the total number of sessions.
|
java.util.List<AoSession> |
getSessionList()
Get the sessionList.
|
SessionListener[] |
getSessionListeners()
Get all session listeners.
|
java.lang.String |
getVersion()
Get the version of the avalon.
|
int |
getWatchdogCount()
Get the session watchdog count.
|
int |
getWatchdogSleep() |
void |
init()
Initialize avalon.
|
protected void |
initSessionNotification(AoFactoryIF aofObject,
java.lang.String serviceName) |
boolean |
isAvalonStarted()
Returns the active state of the Avalon.
|
boolean |
isCleanupObjectEnabled()
Tells if the cleanup operation is enabled
|
boolean |
isRunning()
Get the running state.
|
boolean |
isWorkerMode()
Returns true, when avalon is started in worker mode.
|
static void |
log(java.lang.String msg)
Log the message to standard output
|
static void |
main(java.lang.String[] args)
Main module of this application.
|
static org.omg.CORBA.ORB |
orbInit(java.lang.String[] args,
java.util.Properties props)
Creates a new ORB for Corba clients, servers and the name server.
|
void |
printThreadInfo() |
void |
removeJVMServiceListener(JVMServiceListener l)
Remove a service state listener.
|
void |
removeSession(AoSession aosObj,
int sessionId)
Remove the session from the list of running sessions.
|
void |
removeSessionFromDistributor(int sessionId)
Notify the distributor the session is closed / not used anymore
|
void |
removeSessionListener(SessionListener l)
Remove a session listener.
|
void |
restart()
Restart avalon.
|
void |
run()
Run the application.
|
void |
scheduleStop()
Schedule a server stop.
|
static void |
setAthosEnv(java.lang.String key,
java.lang.String value) |
void |
setCleanupObjectEnabled(boolean enabled)
Sets if the cleanup of unused objects is enabled, so that when the number
of the session objects exceed 100_000, the objects.
|
void |
setCleanupObjectHeap(int heap)
Set the cleanup operation threshold to the given heap.
|
void |
setCleanupObjectLeasing(long minutes)
Sets the cleanup leasing time in minutes.
|
static void |
setOutputStreams(java.lang.String[] args)
Analize the arguments for StdOut and StdErr keywords and set the system
out and err stream.
|
void |
setWatchdogCount(int watchdogCount)
Set the session watchdog count.
|
void |
setWatchdogSleep(int minutes)
Session watchdog sleep, the number of milliseconds use by avalon to do
the session and objects cyclic checks.
|
static java.lang.String |
severityFlagToString(SeverityFlag sevFlag)
Get the string of the SeverityFlag.
|
static void |
showJavaMemory()
Show the used java memeory.
|
void |
terminate(boolean orbStarted)
Terminate process.
|
public static final java.lang.String PROPERTY_NAME_DISTRIBUTOR
public static final java.lang.String PROPERTY_NAME_AVALONWORKERID
public static final java.io.PrintStream STDOUT
public static final java.io.PrintStream STDERR
public static final java.io.InputStream STDIN
public static long PROCESS
public static java.lang.String HOSTNAME
public static final java.lang.String DEFAULT_VERSION
public static final java.lang.String version
public static final java.lang.String DEFAULT_NAME_SERVICE_NAME
public static final java.lang.String DEFAULT_NOTIFICATION_SERVICE_NAME
public static final java.lang.String DEFAULT_NAME_SERVICE_PORT
public static final java.lang.String DEFAULT_CORBA_IMPLEMENTATION
public static final java.lang.String DEFAULT_CORBA_PROTOCOL
public static final java.lang.String CONTROL_FACTORY_PATH
public static final java.lang.String CONTROL_FACTORY_KIND
protected static final int DEFAULT_WATCHDOG_COUNT
protected static final int DEFAULT_OBJECT_HEAP
protected static final int DEFAULT_WATCHDOG_SLEEP
protected static java.lang.String hostname
protected static final java.lang.String loadLibName
protected java.lang.String[] args
protected java.util.Properties properties
protected AvalonConfigurationService avalonConfiguration
public java.lang.String getVersion()
public static void setAthosEnv(java.lang.String key, java.lang.String value)
public java.lang.String getServiceName()
public int getWatchdogCount()
public void setWatchdogCount(int watchdogCount)
watchdogCount
- the new session watchdog count.public void setWatchdogSleep(int minutes)
Use the AVALON property Avalon.SessionWatchdogSleep to control the number of minutes per cycle.
By default it is the default watchdog sleep (10 mins)
Any attempt of setting the watchdog to a bigger value then 10 minutes or smaller then 1 minutes, will fail.
watchdogSleep
- the new session watchdog sleep.public int getWatchdogSleep()
public void setCleanupObjectEnabled(boolean enabled)
Use the AVALON property Avalon.CleanupObjectEnabled to control this switch
enabled
- to be used as the new switchpublic boolean isCleanupObjectEnabled()
public void setCleanupObjectLeasing(long minutes)
Any object not used for the given leasing time, will be seen as expired and therefore suitable for cleanup.
Use the AVALON property Avalon.CleanupObjectLeasing to control the time
minutes
- to be used as leasing time.public long getCleanupObjectLeasing()
public void setCleanupObjectHeap(int heap)
When the given number of objects is reached, the cleanup will be done automatically by avalon, if it is enabled.
Use the AVALON property Avalon.CleanupObjectHeap to control the number of objects
heap
- to be used as thresholdpublic int getCleanupObjectHeap()
public int getNumberOfSession()
protected void cleanupUnusedObjects(AoSession aosObj, int toKeepObjectCount)
AvalonDestroyable
which
AvalonDestroyable.lastAccessTime()()
is smaller than now minus
getWatchdogCount()
* WATCHDOG_SLEEP_TIME
When the number of used object exceed the AVALON threshold, destroy the given toBeDestroyCount from the oldest objects.
aosObj
- the session to be used, must be not NULLtoBeDestroyCount
- to be used, not be a positive integerpublic int getMaxNumberOfSession()
public void addJVMServiceListener(JVMServiceListener l)
l
- the service state listener to be added.public void removeJVMServiceListener(JVMServiceListener l)
l
- the service state listener to be removed.public JVMServiceListener[] getJVMServiceListeners()
public void fireServiceEvent(int state, java.lang.String message)
- public void fireServiceEvent(int state)
- public java.lang.String getRunningState()
public void fireServiceEvent(JVMServiceEvent ev)
- public void addSessionListener(SessionListener l)
l
- the session listener to be added.public void removeSessionListener(SessionListener l)
l
- the Session listener to be removed.public SessionListener[] getSessionListeners()
public void fireSessionEvent(int state, java.lang.String message, AoSession aosObj)
- public void fireSessionEvent(int state, AoSession aosObj)
- public void fireSessionEvent(SessionEvent ev)
- public void removeSession(AoSession aosObj, int sessionId)
sessionId
- The
- session to remove.public void removeSessionFromDistributor(int sessionId)
sessionId
- public void addSession(AoSession aosObj) throws AoException
The
- session to add.AoException
public int getSessionCount()
public java.util.List<AoSession> getSessionList()
public AoSession getSession(int sessionId)
sessionId
- the session Id.public static java.lang.String getDateTime()
public static void log(java.lang.String msg)
msg
- the message.public static void showJavaMemory()
public static Avalon getInstance()
public void scheduleStop()
public boolean isRunning()
isAvalonStarted()
public boolean isAvalonStarted()
true
if
the avalon was started completely, false
if not.true
if the Avalon is started uppublic org.omg.CORBA.ORB getOrb()
public java.lang.String getProperty(java.lang.String key)
public java.lang.String getProperty(java.lang.String key, java.lang.String def)
public int getProperty(java.lang.String key, int def)
public long getProperty(java.lang.String key, long def)
public boolean getProperty(java.lang.String key, boolean def)
public int getNextSessionId() throws com.highqsoft.avalon.AvalonException
com.highqsoft.avalon.AvalonException
public org.omg.CosNaming.NameComponent[] checkAndRebind(org.omg.CosNaming.NamingContext nsContext, org.omg.CosNaming.NameComponent[] path, org.omg.CORBA.Object aofRef, boolean orbStarted) throws org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName, org.omg.CosNaming.NamingContextPackage.NotFound
nsContext
- context of the name service where to bind the object.path
- path of the object to bind.aofRef
- the object to bind.orbStarted
- flags if the orb is started.org.omg.CosNaming.NamingContextPackage.CannotProceed
- CORBA exceptionorg.omg.CosNaming.NamingContextPackage.InvalidName
- CORBA exceptionorg.omg.CosNaming.NamingContextPackage.NotFound
- CORBA exceptionpublic void run()
run
in interface java.lang.Runnable
public void terminate(boolean orbStarted)
public void init()
public boolean exit()
public void restart()
public static org.omg.CORBA.ORB orbInit(java.lang.String[] args, java.util.Properties props)
args
- Command-line arguments for the application's main method. May
be null.props
- Application-specific properties. May be null.public java.lang.String[] getOrbArguments()
protected java.util.Properties getOrbProperties()
public static void setOutputStreams(java.lang.String[] args)
args
- The startup arguments.public static void main(java.lang.String[] args)
public int getDebugLevel()
public boolean isWorkerMode()
public com.highqsoft.avalon.AvalonDistributorFactory getAvalonDistributorFactory()
public java.lang.String getAvalonWorkerId()
public static java.lang.String aoExceptionToString(AoException aoException)
aoException
- the exception.public static java.lang.String severityFlagToString(SeverityFlag sevFlag)
sevFlag
- the severity flag.protected void initSessionNotification(AoFactoryIF aofObject, java.lang.String serviceName) throws AoException
AoException
public void printThreadInfo()