Provide more ways to run with Context
See original GitHub issueIn our codebase, we push RequestContext and immediately run some code with try-with-resources.
For example:
try (SafeCloseable ignored = ctx.push()) {
logger.trace(decorate(msg));
}
If RequestContext provides run(Runnable) or call(Callable) we can reduce boilerplate code and simplify it.
ctx.run(() -> logger.trace(decorate(msg));
This is inspired by gRPC Context API.
https://grpc.github.io/grpc-java/javadoc/io/grpc/Context.html#run-java.lang.Runnable-
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
How to use React Context like a pro - Devtrium
React Context can be a very powerful tool, and there are several tricks to using it effectively. Several patterns can be used to...
Read more >How to use React Context effectively - Kent C. Dodds
In Application State Management with React, I talk about how using a mix of local state and React Context can help you manage...
Read more >Context Managers and Python's with Statement
More and more objects in the Python standard library now provide support for the context management protocol so you can use them in...
Read more >Provide more ways to bail out inside Hooks #14110 - GitHub
Wrote an article based on developing a Redux clone based on existing API - context and hooks which explains more. Two things are...
Read more >How To Use Contexts in Go - DigitalOcean
In this tutorial, you will start by creating a Go program that uses a context within a function. Then, you will update that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Sure, please take a look! 🙇♂️
Could I handle this issue?