Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

Conversation

lucaswin-amzn
Copy link
Contributor

Cleanup elastic thread context element

Description of changes:
Make ElasticThreadContextElement cleaner.

Build output:

alerting lucaswin$ ./gradlew build

> Configure project :alerting
=======================================
Elasticsearch Build Hamster says Hello!
  Gradle Version        : 5.5.1
  OS Info               : Mac OS X 10.14.6 (x86_64)
  JDK Version           : 12 (Oracle Corporation 12.0.2 [Java HotSpot(TM) 64-Bit Server VM 12.0.2+10])
  JAVA_HOME             : /Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home
  Random Testing Seed   : E658BDD928D35147
=======================================

> Task :alerting-notification:compileJava
Note: /Users/lucaswin/Desktop/github/alerting-backend/alerting/notification/src/main/java/com/amazon/opendistroforelasticsearch/alerting/destination/Notification.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :alerting-notification:test
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.easymock.cglib.core.ReflectUtils$1 (file:/Users/lucaswin/.gradle/caches/modules-2/files-2.1/org.easymock/easymock/4.0.1/26f1c39bd323b6ac7fe0c4c8e33bfdffcdde03a2/easymock-4.0.1.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.easymock.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 3m 1s
50 actionable tasks: 49 executed, 1 up-to-date

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@lucaswin-amzn lucaswin-amzn requested review from dbbaughe, a user and jinsoor-amzn August 15, 2019 20:09

companion object Key : CoroutineContext.Key<ElasticThreadContextElement>
private var initialContext: StoredContext? = threadContext.newStoredContext(true)
private var initialContext: StoredContext = threadContext.newStoredContext(true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be val now that we don't re-assign this variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We reassign it on line 167

        initialContext = threadContext.stashContext()

ghost
ghost previously approved these changes Aug 16, 2019
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename initialContext to context as it's no longer set just at the start.

Copy link
Contributor

@dbbaughe dbbaughe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@lucaswin-amzn lucaswin-amzn merged commit cf49e4e into opendistro-for-elasticsearch:master Aug 20, 2019
@lucaswin-amzn lucaswin-amzn deleted the cleanup-ElasticThreadContextElement branch August 20, 2019 16:15
tlfeng pushed a commit that referenced this pull request Feb 6, 2021
* Cleanup ElasticThreadContextElement.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants