diff options
author | Sergey Nastich <nastich@users.noreply.github.com> | 2018-08-24 13:41:27 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-24 13:41:27 -0400 |
commit | df1a2f7fcbdd85ac84162cf8eae8cdb6bb25cbb5 (patch) | |
tree | cdfb528e1d4569bfc973b784e6a763b02108442c /src/main/scala/xyz/driver/core/logging | |
parent | 46306f0c8f7e88e55a3b18df8ab212e9ea5e01f1 (diff) | |
download | driver-core-df1a2f7fcbdd85ac84162cf8eae8cdb6bb25cbb5.tar.gz driver-core-df1a2f7fcbdd85ac84162cf8eae8cdb6bb25cbb5.tar.bz2 driver-core-df1a2f7fcbdd85ac84162cf8eae8cdb6bb25cbb5.zip |
Migration to `java.time.Instant` and `java.time.LocalDate`: Part 1 (#200)v1.13.0
* Add semi-backwards-compatible JSON formats and path matchers for java.time.Instant and java.time.LocalDate
* Use `Clock` in `ApplicationContext` instead of `TimeProvider`, deprecate `TimeProvider`
* Add `ChangeableClock` in time package for tests
* Add generators for instants and LocalDates
Diffstat (limited to 'src/main/scala/xyz/driver/core/logging')
-rw-r--r-- | src/main/scala/xyz/driver/core/logging/MdcExecutionContext.scala | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/main/scala/xyz/driver/core/logging/MdcExecutionContext.scala b/src/main/scala/xyz/driver/core/logging/MdcExecutionContext.scala index df21b48..11c99f9 100644 --- a/src/main/scala/xyz/driver/core/logging/MdcExecutionContext.scala +++ b/src/main/scala/xyz/driver/core/logging/MdcExecutionContext.scala @@ -13,18 +13,16 @@ import scala.concurrent.ExecutionContext class MdcExecutionContext(executionContext: ExecutionContext) extends ExecutionContext { override def execute(runnable: Runnable): Unit = { val callerMdc = MDC.getCopyOfContextMap - executionContext.execute(new Runnable { - def run(): Unit = { - // copy caller thread diagnostic context to execution thread - Option(callerMdc).foreach(MDC.setContextMap) - try { - runnable.run() - } finally { - // the thread might be reused, so we clean up for the next use - MDC.clear() - } + executionContext.execute { () => + // copy caller thread diagnostic context to execution thread + Option(callerMdc).foreach(MDC.setContextMap) + try { + runnable.run() + } finally { + // the thread might be reused, so we clean up for the next use + MDC.clear() } - }) + } } override def reportFailure(cause: Throwable): Unit = executionContext.reportFailure(cause) |