What is the correct way to use SoamFactory initialization and uninitialization?

Regardless of whether you are using the IBM® Spectrum Symphony API in a server or standalone client, the initialization and uninitialization rules are the same.

Initialization

You must initialize the IBM Spectrum Symphony API before further use. The API initialization is valid for the whole process. So, if you are using the IBM Spectrum Symphony API in multiple threads, initializing the API in one thread will mean that the API can be used in any of the other threads in the process.

In some multi-threaded applications, it might be easier if the threads could run independently, ignorant to whether another thread has initialized the Symphony API. This can be achieved easily, as it is safe to initialize the API more than once, by calling the following multiple times:
  • C++: SoamFactory::initialize()
  • Java™: SoamFactory.initialize()
  • .NET: SoamFactory.Initialize()

The API will be initialized the first time that the method is called. Subsequent calls to the initialization method will have no effect. Each thread can perform its own SoamFactory initialization before using the IBM Spectrum Symphony API.

Uninitialization

You must uninitialize the IBM Spectrum Symphony API by calling the following when you are completely finished using the API for the lifetime of the client process:
  • C++: SoamFactory::uninitialize()
  • Java: SoamFactory.uninitialize()
  • .NET: SoamFactory.Uninitialize()

You cannot re-initialize the API after it has been uninitialized.

If you are using the IBM Spectrum Symphony API in a server application or daemon process, you should uninitialize the API only when the server is shutting itself down. If this is impossible to do, you may consider not uninitializing the API at all. However, this is not recommended.

Note: Do not call the SoamFactory uninitialization method during the execution of callback method. This will result in deadlock.