-
Notifications
You must be signed in to change notification settings - Fork 115
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
Reorganize local storing of Tx #1569
base: hotfix-1.10.x
Are you sure you want to change the base?
Conversation
core/src/main/java/com/gentics/mesh/core/endpoint/node/BinaryUploadHandlerImpl.java
Outdated
Show resolved
Hide resolved
Tx.threadLocalGraph.set(tx); | ||
Optional.ofNullable(Vertx.currentContext()) | ||
.ifPresentOrElse( | ||
ctx -> ctx.putLocal("tx", Optional.ofNullable(tx)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual change. There are get()
and getLocal()
in the Vert.x Context
, which seem to be functionally equal, but getLocal()
has internal usages.
return Tx.threadLocalGraph.get(); | ||
Optional<Context> maybeVertxContext = Optional.ofNullable(Vertx.currentContext()); | ||
if (maybeVertxContext.isPresent()) { | ||
Context vertxContext = maybeVertxContext.get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't mix the cases where we have an empty Context, and where we have no Context at all.
...a/com/gentics/mesh/core/field/binary/AbstractBinaryFieldUploadEndpointParameterizedTest.java
Outdated
Show resolved
Hide resolved
tests/tests-core/src/main/java/com/gentics/mesh/core/graphql/GraphQLEndpointStressTest.java
Outdated
Show resolved
Hide resolved
Postponed by now. |
Abstract
One should never store a thing in ThreadLocal, since we operate async contexts, not threads.
Checklist
General
/CHANGELOG.adoc
On API Changes