Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.
This repository was archived by the owner on May 30, 2024. It is now read-only.

Users Not created unless client connection closed, so does this means do we need to close connection for each request #142

@prageethw

Description

@prageethw

user not get created:
import java.io.IOException;

import com.launchdarkly.client.FeatureFlagsState;
import com.launchdarkly.client.LDClient;
import com.launchdarkly.client.LDUser;

public class FeatureSample {
private static final String YOUR_SDK_KEY = "sdk-7799b0db-8d76-480b-a072-2073134ed1b3";
private static LDUser user;
private static final LDClient ldClient = new LDClient(YOUR_SDK_KEY);

public static void main(final String[] args) throws IOException {
	long startTime = System.currentTimeMillis();
	user = new LDUser.Builder("default").email("ernestina@example.com").custom("deviceType", "YL0008787782").build();
	validateFetaureFlags(user);
	displayFeatureFlags(user);
	long stopTime = System.currentTimeMillis();
	long elapsedTime = stopTime - startTime;
	System.out.println(elapsedTime);
	//ldClient.close();
}

private static void validateFetaureFlags(final LDUser user) {
	boolean showFeature = ldClient.boolVariation("offers", user, false);
	System.out.println(showFeature);
}

private static void displayFeatureFlags(final LDUser user) {
	FeatureFlagsState state = ldClient.allFlagsState(user);
	System.out.println(state.toValuesMap().toString());
}

}

the user gets created:
import java.io.IOException;

import com.launchdarkly.client.FeatureFlagsState;
import com.launchdarkly.client.LDClient;
import com.launchdarkly.client.LDUser;

public class FeatureSample {
private static final String YOUR_SDK_KEY = "sdk-7799b0db-8d76-480b-a072-2073134ed1b3";
private static LDUser user;
private static final LDClient ldClient = new LDClient(YOUR_SDK_KEY);

public static void main(final String[] args) throws IOException {
	long startTime = System.currentTimeMillis();
	user = new LDUser.Builder("default").email("ernestina@example.com").custom("deviceType", "YL0008787782").build();
	validateFetaureFlags(user);
	displayFeatureFlags(user);
	long stopTime = System.currentTimeMillis();
	long elapsedTime = stopTime - startTime;
	System.out.println(elapsedTime);
	ldClient.close();
}

private static void validateFetaureFlags(final LDUser user) {
	boolean showFeature = ldClient.boolVariation("offers", user, false);
	System.out.println(showFeature);
}

private static void displayFeatureFlags(final LDUser user) {
	FeatureFlagsState state = ldClient.allFlagsState(user);
	System.out.println(state.toValuesMap().toString());
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions