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

optimize: replace with lambda #2967

Merged
merged 18 commits into from
Aug 4, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import java.util.HashMap;
import java.util.Map;

import io.seata.common.loader.LoadLevel;

/**
Expand All @@ -28,13 +27,7 @@
@LoadLevel(name = "ThreadLocalContextCore", order = Integer.MIN_VALUE)
public class ThreadLocalContextCore implements ContextCore {

private ThreadLocal<Map<String, String>> threadLocal = new ThreadLocal<Map<String, String>>() {
@Override
protected Map<String, String> initialValue() {
return new HashMap<String, String>();
}

};
private ThreadLocal<Map<String, String>> threadLocal = ThreadLocal.withInitial(() -> new HashMap<>());

@Override
public String put(String key, String value) {
Expand Down