Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed locking from Adjust singleton creation #404

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Adjust/sdk-core/src/main/java/com/adjust/sdk/Adjust.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
*/
public class Adjust {
/**
* Singleton Adjust SDK instance.
* eagerly create singleton Adjust SDK instance immediately when the class is loaded or initialized by Android ClassLoader
*/
private static AdjustInstance defaultInstance;

private volatile AdjustInstance defaultInstance;
/**
* Private constructor.
*/
Expand All @@ -30,12 +29,16 @@ private Adjust() {
*
* @return Adjust SDK singleton instance.
*/
public static synchronized AdjustInstance getDefaultInstance() {
public static AdjustInstance getDefaultInstance() {
@SuppressWarnings("unused")
String VERSION = "!SDK-VERSION-STRING!:com.adjust.sdk:adjust-android:4.19.0";

if (defaultInstance == null) {
defaultInstance = new AdjustInstance();
synchronized (Adjust.class) {
if (defaultInstance == null) {
defaultInstance = new AdjustInstance();
}
}
}
return defaultInstance;
}
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### Version 4.19.1 (10th December 2019)
#### Added
- removed locking from singleton instance creation


### Version 4.19.0 (9th December 2019)
#### Added
- Added `disableThirdPartySharing(Context)` method to `Adjust` interface to allow disabling of data sharing with third parties outside of Adjust ecosystem.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.19.0
4.19.1