Singleton Class Factory

The Singleton Class Factory creates a single instance of the service class and uses this same instance to execute all requests coming in from clients.

Options are provided to either allow several client requests to run simultaneously, or to synchronize requests so that only one request at a time is answered. It depends on whether the implementation of your service is already thread-safe or does its own thread synchronization where needed.

Use Cases

Use the Singleton Class Factory in scenarios where a common set of server data is shared by all clients, or for simplistic services that do not rely on any per-instance state to be stored inside the class.

If your service code is fully contained in the respective method and does not rely on any class-wide fields, the (unsynchronized) singleton model will provide best performance.

Class Factory Types

See Also