There is a service IKernel, which controls the shutdown of a node.

Getting the service

The service is fetched as a singleton from the service registry:

final IKernel kernel = CServiceRegistry.getInstance()

As always, make sure that the service starter of your package has a dependency on the IKernel to ensure that the service already exists.

Shutting down

The kernel distinguishes between two different types of shutting down. The first kind is a simple System.exit(code). Calling this method is preferable to a System.exit(), since we reserve the right to add more functionality at a later time.

void shutDownHard(int aCode);

The other way of shutting down is a bit gentler. All namespaces except the SYSTEM namespace are shut down in order. Only then is a System.exit() executed.

    void shutDown(int aCode);

Check if the shut-down is in progress

Of course, this call only works with the slow shutdown, where the namespaces are shut down.

boolean isShutDownInProgress();

Shutdown codes

A few shutdown codes are predefined in the enum EShutDownCodes. - Innovative Distributed System