Java Code Examples for reactor.core.Scannable#name()
The following examples show how to use
reactor.core.Scannable#name() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FluxMetrics.java From reactor-core with Apache License 2.0 | 6 votes |
/** * Extract the name from the upstream, and detect if there was an actual name (ie. distinct from {@link * Scannable#stepName()}) set by the user. * * @param source the upstream * * @return a name */ static String resolveName(Publisher<?> source) { Scannable scannable = Scannable.from(source); if (scannable.isScanAvailable()) { String nameOrDefault = scannable.name(); if (scannable.stepName() .equals(nameOrDefault)) { return REACTOR_DEFAULT_NAME; } else { return nameOrDefault; } } else { log.warn("Attempting to activate metrics but the upstream is not Scannable. " + "You might want to use `name()` (and optionally `tags()`) right before `metrics()`"); return REACTOR_DEFAULT_NAME; } }
Example 2
Source File: FluxTimeout.java From reactor-core with Apache License 2.0 | 5 votes |
@Nullable static String addNameToTimeoutDescription(Publisher<?> source, @Nullable String timeoutDescription) { if (timeoutDescription == null) { return null; } Scannable s = Scannable.from(source); if (s.isScanAvailable()) { return timeoutDescription + " in '" + s.name() + "'"; } else { return timeoutDescription; } }