dkuppitz commented on a change in pull request #1029: Updates the API within
the core project.
URL: https://github.com/apache/tinkerpop/pull/1029#discussion_r246178122
##########
File path:
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/AbstractThreadLocalTransaction.java
##########
@@ -38,25 +38,12 @@
*/
public abstract class AbstractThreadLocalTransaction extends
AbstractTransaction {
protected final ThreadLocal<Consumer<Transaction>>
readWriteConsumerInternal =
- new ThreadLocal<Consumer<Transaction>>() {
- @Override protected Consumer<Transaction> initialValue() {
- return READ_WRITE_BEHAVIOR.AUTO;
- }
- };
+ ThreadLocal.withInitial(() -> READ_WRITE_BEHAVIOR.AUTO);
protected final ThreadLocal<Consumer<Transaction>> closeConsumerInternal =
- new ThreadLocal<Consumer<Transaction>>() {
- @Override protected Consumer<Transaction> initialValue() {
- return CLOSE_BEHAVIOR.ROLLBACK;
- }
- };
+ ThreadLocal.withInitial(() -> CLOSE_BEHAVIOR.ROLLBACK);
- protected final ThreadLocal<List<Consumer<Transaction.Status>>>
transactionListeners = new ThreadLocal<List<Consumer<Transaction.Status>>>() {
- @Override
- protected List<Consumer<Transaction.Status>> initialValue() {
- return new ArrayList<>();
- }
- };
+ protected final ThreadLocal<List<Consumer<Transaction.Status>>>
transactionListeners = ThreadLocal.withInitial(() -> new ArrayList<>());
Review comment:
`ThreadLocal.withInitial(ArrayList::new)`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services