Package com.tailf.ncs
Class NcsMain
Object
com.tailf.ncs.NcsMain
- All Implemented Interfaces:
Runnable,Thread.UncaughtExceptionHandler
Main class for Ncs java vm management and control.
This class implements the Runnable interface and should be started in a
thread which becomes the Ncs java vm main thread.
Normally this thread is instantiated and started by the
NcsJVMLauncher which contains a main() method.
It is however possible to embed and start the NcsMain thread from any
other java program by inserting the following code snippet:
NcsMain ncs = NcsMain.getInstance(host, port); Thread ncsThread = new Thread(ncs); ncsThread.start();The Ncs java vm main thread will connect to the Ncs Server and start negotiation of which packages/components that should be instantiated registered and started. No manual registration is necessary.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThis field represents a system property controlling which classloader the Ncs java vm should use. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidabortNcsJavaVM(Object obj) Deprecated.static voidabortNcsJavaVM(Object obj, int code) Deprecated.Useshutdown()instead.static voidabortNcsJavaVM(Object obj, int code, String message) Deprecated.Useshutdown()instead.Get the address for the Ncs Servercom.tailf.ncs.ctrl.ApplicationMuxManagerGet the ApplicationMuxManager.com.tailf.ncs.ctrl.DpMuxManagerGet the DpMuxManager.static NcsMainGet the instance associated with the current threadstatic NcsMaingetInstance(String host, int port) Deprecated.UsegetInstance(SocketAddress)instead.static NcsMaingetInstance(SocketAddress address) Get an instance that should connect to the given address.Get the instance associated with the current threadDeprecated.Use thegetAddress()method insteadintDeprecated.Use thegetAddress()method insteadcom.tailf.ncs.ctrl.NedMuxManagerGet the NedMuxManager.Get the ResourceManager.Get the Ncs AlarmSinkCentral instanceGet the Ncs AlarmSourceCentral instancehandlePackageException(Object instance, Throwable e) handlePackageException(String packageName, Throwable e) voidinstantiatePackageComponent(com.tailf.ncs.ctrl.NcsPDData pdData) Instantiates and registers components for a Ncs PackagebooleanbooleanCheck if Ncs main thread is startedstatic booleanDeprecated.static booleanDeprecated.booleanChecks if this instance was started with the Tail-f Jar classloader, as opposed to running with the standard java system classloader.voidredeployPackage(com.tailf.ncs.ctrl.NcsPDData pdData) Hot redeploy of all components for a packagestatic ThrowableDeprecated.UsehandlePackageException(ClassLoader, Throwable)instead.static ThrowablereportPackageException(Object instance, Throwable e) Deprecated.UsehandlePackageException(Object, Throwable)instead.static ThrowablereportPackageException(String packageName, Throwable e) Deprecated.UsehandlePackageException(String, Throwable)instead.voidrestartPackage(String packageName) voidrestartPackageNow(String packageName) voidrun()This method is the Ncs java vm main thread startvoidshutdown()shutdown Ncs java vm main threadstatic voidsubmitPackageAlarm(ClassLoader cl, ConfIdentityRef alarmType, PerceivedSeverity severity, boolean cleared, String alarmText) static voidsubmitPackageAlarm(Object instance, ConfIdentityRef alarmType, PerceivedSeverity severity, boolean cleared, String alarmText) static voidsubmitPackageAlarm(String packageName, ConfIdentityRef alarmType, PerceivedSeverity severity, boolean cleared, String alarmText) voiduncaughtException(Thread t, Throwable e)
-
Field Details
-
TAILF_CLASSLOADER
This field represents a system property controlling which classloader the Ncs java vm should use. If the system classloader is preferred this property should be set "false". The default is true If the system classloader is used, redeployment is not possible Example: java -cp ... -DTAILF_CLASSLOADER=false com...NcsJVMLauncher- See Also:
-
-
Method Details
-
getNcsHost
Deprecated.Use thegetAddress()method insteadGet the hostname or ip for the Ncs Server- Returns:
- String hostname or ip for Ncs server
-
getNcsPort
Deprecated.Use thegetAddress()method insteadGet the port number for the Ncs Server- Returns:
- int Ncs server port
-
getAddress
Get the address for the Ncs Server- Returns:
- String the address for the Ncs server
-
getSinkCentral
Get the Ncs AlarmSinkCentral instance- Returns:
- AlarmSinkCentral
-
getSourceCentral
Get the Ncs AlarmSourceCentral instance- Returns:
- AlarmSourceCentral
-
getDPMuxManager
public com.tailf.ncs.ctrl.DpMuxManager getDPMuxManager()Get the DpMuxManager. This Manager controls the Dp instances and all registered callback components from all packages- Returns:
- DpMuxManager
-
getNedMuxManager
public com.tailf.ncs.ctrl.NedMuxManager getNedMuxManager()Get the NedMuxManager. This Manager controls the NedMux and all registered Ned components from all packages- Returns:
- NedMuxManager
-
getApplicationMuxManager
public com.tailf.ncs.ctrl.ApplicationMuxManager getApplicationMuxManager()Get the ApplicationMuxManager. This Manager controls all Application component threads from all packages- Returns:
- ApplicationMuxManager
-
getResourceManager
Get the ResourceManager.- Returns:
- ResourceManager the resource manager for this NCS instance
-
run
public void run()This method is the Ncs java vm main thread start -
isTailFClassloader
Deprecated.Checks if NcsMain was started with the Tail-f Jar classloader, as opposed to running with the standard java system classloader. The default is running with the Tail-f Jar classloader, which is necessary to be able to perform component hot re-deploy.- Returns:
- true if the Tail-f Jar classloader is active
-
isUsingTailFClassloader
public boolean isUsingTailFClassloader()Checks if this instance was started with the Tail-f Jar classloader, as opposed to running with the standard java system classloader. The default is running with the Tail-f Jar classloader, which is necessary to be able to perform component hot re-deploy.- Returns:
- true if the Tail-f Jar classloaded is active
-
isAddingPkgs
public boolean isAddingPkgs() -
instantiatePackageComponent
Instantiates and registers components for a Ncs Package- Parameters:
pdData-- Throws:
Exception
-
redeployPackage
Hot redeploy of all components for a package- Parameters:
pdData-- Throws:
Exception
-
isStarted
Deprecated.Check if Ncs main thread is started- Returns:
- true if the Ncs main thread is running
-
isRunning
public boolean isRunning()Check if Ncs main thread is started- Returns:
- true if the Ncs main thread is running
-
getInstance
Get the instance associated with the current thread- Returns:
- the instance associated with the current thread or null if no instance has been started
-
getLocalInstance
Get the instance associated with the current thread- Returns:
- an optional containng the instance associated with the current thread or empty of no instance has been started
-
getInstance
Deprecated.UsegetInstance(SocketAddress)instead.Get the singleton instance of the NcsMain class- Parameters:
host- the NCS host to connect toport- the NCS port to connect to- Returns:
- NcsMain instance
-
getInstance
Get an instance that should connect to the given address. If an instance already exists for the given address it is returned.- Returns:
- an instance that is connected or will connect to the given address
-
abortNcsJavaVM
Deprecated.Useshutdown()instead.Abort Ncs Java VM- Parameters:
obj-
-
abortNcsJavaVM
Deprecated.Useshutdown()instead.Abort Ncs Java VM- Parameters:
obj-code-
-
abortNcsJavaVM
Deprecated.Useshutdown()instead.Abort Ncs Java VM- Parameters:
obj-code-message-
-
reportPackageException
Deprecated.UsehandlePackageException(Object, Throwable)instead. -
reportPackageException
Deprecated.UsehandlePackageException(ClassLoader, Throwable)instead. -
reportPackageException
Deprecated.UsehandlePackageException(String, Throwable)instead. -
handlePackageException
-
handlePackageException
-
handlePackageException
-
submitPackageAlarm
public static void submitPackageAlarm(Object instance, ConfIdentityRef alarmType, PerceivedSeverity severity, boolean cleared, String alarmText) -
submitPackageAlarm
public static void submitPackageAlarm(ClassLoader cl, ConfIdentityRef alarmType, PerceivedSeverity severity, boolean cleared, String alarmText) -
submitPackageAlarm
public static void submitPackageAlarm(String packageName, ConfIdentityRef alarmType, PerceivedSeverity severity, boolean cleared, String alarmText) -
shutdown
public void shutdown()shutdown Ncs java vm main thread -
restartPackage
-
restartPackageNow
-
uncaughtException
- Specified by:
uncaughtExceptionin interfaceThread.UncaughtExceptionHandler
-
shutdown()instead.