-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define asynchronous
ProfilesManager
operations
- Loading branch information
1 parent
352e1b2
commit ade2e9c
Showing
6 changed files
with
247 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
service/src/main/java/org/whispersystems/textsecuregcm/util/AsyncTimerUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.whispersystems.textsecuregcm.util; | ||
|
||
import io.micrometer.core.instrument.Timer; | ||
import javax.annotation.Nonnull; | ||
import java.util.concurrent.CompletionStage; | ||
import java.util.function.Supplier; | ||
|
||
public class AsyncTimerUtil { | ||
@Nonnull | ||
public static <T> CompletionStage<T> record(final Timer timer, final Supplier<CompletionStage<T>> toRecord) { | ||
final Timer.Sample sample = Timer.start(); | ||
return toRecord.get().whenComplete((ignoreT, ignoreE) -> sample.stop(timer)); | ||
} | ||
|
||
} |
Oops, something went wrong.