Open magicprinc opened 1 year ago
- AtomicBoolean fields are final
OK
- lambda expression instead of code block
Aren't those braces ignored, anyway? It's just a single expression. (The indenting of the modified code is off, btw.)
All around the World, people write this method again and again. I have done it too. We really need "The Chosen One". I recommend you to be this one :-)
Does this utility belong in FailsafeCall.java
? If included at all, wouldn't it be better as a single static method in a utility class?
Aren't those braces ignored, anyway? It's just a single expression. (The indenting of the modified code is off, btw.)
IntelliJ IDEA's work :-)
As I know, the resulting byte code is the same.
Does this utility belong in FailsafeCall.java? If included at all, wouldn't it be better as a single static method in a utility class?
To be honest, not 100%... but I really want to drop such "one method utility class" in my codebase. And I don't like to add new dependencies. Failsafe have managed after long testing, etc.
🙏
If you do some research in Internet, you will find that people reinvent this wheel over and over, write almost the same method over and over. We must protect the Earth from global warming! :-)
As a small sign of gratitude, I won't then write an issue about a large PR to concurrentunit (Excellent library BTW)
Your wish is my command. Tell me if I should send an PR.
Not up to me.
As you can see here: https://github.com/magicprinc/failsafe/commit/c517e3ef01aec35cd6b6aaa23779873f8e89ffab
FailsafeCall micro refactoring: 1) AtomicBoolean fields are final 2) lambda expression instead of code block
2) World-Wide Nr.1 duplicated utility method for OkHttp `/* [OkHttp Callback to JDK CompletableFuture]
Helps eliminate dozens of utility classes World-wide with exactly this same method.
Can be the first small step towards FailSafe.
Returns normal JDK {@link CompletableFuture} without FailSafe policies. /
public static CompletableFuture asPromise (okhttp3.Call call)`
All around the World, people write this method again and again. I have done it too. We really need "The Chosen One". I recommend you to be this one :-)
If you like it, I will send it as PR.