Runtime Configuration of ACDK


How to use runtime configure in ACDK applications.

Content of this chapter:

   Over all description of runtime configuration
   Command Line options
   Property files
     Global acdk configuration
     Application specific configuration
   Further configuation
     User defined properties files
     Enhanced configuration

 Over all description of runtime configuration

Different to configuration at compile time, the runtime configuration is used to control ACDK functionality at runtime.
The runtime configuration can also be used for user defined configuration values of applications.


Configuration using the System properties (see  acdk::lang::System for System::getProperty(), setProperty()) of an ACDK application is done on multiple steps:
  • Read the operation system environment into the System properties.
  • Read the configuration file $ACDKTOOLSHOME/cfg/acdk.cfg if exists.
  • Read the configuration file myexecutable.cfg in the same directory as the executable if exists.
  • Parse the command line options (especially the -D options.

Each step will overwrite the values, which are configured previous steps.

 Command Line options

acdk::lang::System::main() understands following flags:
  • -acdk-st: run in single thread modus. Object::lock() will have no effect.
  • -acdk-home=[homedir] set internally this as ACDK_HOME env variable.
    This variable often used when a ACDK application looks for its configuration files. The standard ClassLoader also try to find ACDK libraries in the ACDK_HOME/bin directory.
  • -acdk-tools-home=[homedir] set internally this as ACDK_TOOLS_HOME env variable.
    Has same usage as -acdk-home but overwrite -acdk-home. This is used if acdk tools are used which are stored in a directory not equal to ACDKHOME.
    If ACDK_TOOLS_HOME is not set, the parent directory of the executable will be used (executable=acdk/bin/myexe, ACDK_TOOLS_HOME=acdk ).
  • -acdk-path=[pathlist] set internally ACDKPATH env variable.
    Variable will be used by the ClassLoader to locate additionally ACDK libraries.
    Multiple path should be devided by the path seperator (':' on unix and ';' on windows platform). The argument -acdk-path=path can also specified multiple times on the command line.
  • -Dkey=value: Define a system property.


    Command line options, starting with -D are reserved to ACDK.
  • -acdk-st: Run the executable in single thread mode. No synchronization will be done. This option can improve performance in single threaded application, but may be crash in multithreaded applications.
  • -acdk-sp: The application run on a single cpu machine.
    On some platforms this option speed up executation about a factor of 0.10 - 0.20.
    But on other platform - which have no native support for atomic integer operation - the executable will be speed up by a factor up to 2.
  • -acdk-enc [char enc]: This option set the "user.encoding" property. This string value will be used as default encoding for all CharReader/Writer.
    See also  String Encoding for valid values.
  • -loglevel [loglevel]: Set the threshold value for all logging. All log message with a lower log level will discarged. By default the threshold is 'Warn'.
    loglevel can be either a integer between 0 (all log message will print) and 65535 (no log message will print) or a string value: All, Trace, Debug, Info, Note, Warn, Error, Fatal, None.
  • -acdk-pa: Use the PagedHeap-Allocator.
  • -acdk-rc: Use only Reference Counting. No debugging information about the heaps is availabe.
  • -acdk-rcgc: Use Reference Counting + Mark/Sweep collection.
  • -acdk-gc: Use the Boehm Conservative Collector.
    Only available if compiled and linked with the the Boehm Conservative Collector.
    -acdk-gc is Experimental and may not work.
  • -acdk-maxmem [maxmem]: Limit usage of process to memory in megabyte.
    if maxmem is -1 process memory usage is unlimited.
    By default memory usage is limited to 1000 MB.
These flags will striped from the command line and the applications main function will not see it.

 Property files

 Global acdk configuration

Global configuration (for all users and ACDK applications) can be done in the $ACDKHOME/cfg/acdk.cfg. The orignal file can be found in acdk_core/cfg/acdk.cfg.

Here the default acdk.cfg provided by the ACDK distribution:

< Cannot include file acdk_core/cfg/acdk.cfg >

 Application specific configuration

On startup ACDK looks for a file name with the same file name of the executable (excluding '.exe' on Windows) and a .cfg.
ACDK expects that this file is a property file. ACDK will load this property file at startup and in case of re-initialization.

 Further configuation

 User defined properties files

Applications can define their own properties files and load them with the  acdk::util::Properties load() method.

 Enhanced configuration

With the  CfgScript language more advanced configuration can be done: not only setting passive strings, which has to be evaluated in the applications code, but real glue code to connect C++ and CfgScript classes.