• HOME
  • INTEGRATIONS
  • SDKS
  • GUIDES
  • API DOCS
No results for ""
EXPAND ALL
launchdarkly.com

EDIT ON GITHUB

Shutting down

Read time: 2 minutes
Last edited: Jun 18, 2021

Overview

This topic explains how to safely shut down different LaunchDarkly SDKs. This feature is available for both client-side and server-side SDKs.

Shutting down an SDK

LaunchDarkly SDKs use language-specific methods to shut down their instances safely. In most applications, you do not have to manually shut down an SDK.

Details about each SDK's configuration are available in the SDK-specific sections below.

  • Client-side SDKs
  • Server-side SDKs

Client-side SDKs

This feature is available in the following client-side SDKs:

C/C++ (client-side)

To fully uninitialize the C/C++ SDK resources, you must use close. The operation blocks until all resources are free. It is not safe to use any API methods after this process is initiated.

1LDClientClose(client);

Xamarin

Dispose safely shuts down the client instance and releases all resources associated with the client. In most long-running applications, you do not have to call dispose.

1ldClient.Dispose();

Server-side SDKs

This feature is available in the following server-side SDKs:

.NET

Dispose safely shuts down the client instance and releases all resources associated with the client. In most long-running applications, you do not have to call Dispose.

1ldClient.Dispose();

C/C++ (server-side)

LDClientClose uninitializes the resources the C/C++ SDK uses. The operation blocks until all resources are free. It is not safe to use any API methods after this process is initiated.

1LDClientClose(client);

Erlang

stop_instance(), stop_instance(Tag), and stop_all_instance() all safely shut down client instances and releases the resources associated with them.

In most long-running applications, you will not have to call these functions. You can use them to ensure all events have been flushed synchronously before closing your application.

Do not evaluate flags after any of these functions have been initiated.

ldclient:stop_all_instances()

% Stops the default instance
ldclient:stop_instance()

% Stops a named instance
ldclient:stop_instance(my_instance)

Haskell

close safely shuts down the client instance and releases all resources associated with the client.

In most long-running applications, you do not have to call close, but you can use it to ensure all events have been flushed synchronously before closing your application.

You should not evaluate flags after close has been initiated.

1close client

Java

Close safely shuts down the client instance and releases all resources associated with the client. In most long-running applications, you do not have to call close.

1ldClient.close()

Node.js (server-side)

Close safely shuts down the client instance and releases all resources associated with the client. In most long-running applications, you do not have to call close.

1ldClient.close();

Python

Close safely shuts down the client instance and releases all resources associated with the client. In most long-running applications, you do not have to call close.

1ldclient.get().close()

Ruby

Close safely shuts down the client instance and releases all resources associated with the client. In most long-running applications, you do not have to call close.

1ld_client.close