public final class SoyFutureValueProvider extends SoyAbstractCachingValueProvider
SoyValueProvider implementation that represents a wrapped future.
| Modifier and Type | Class and Description |
|---|---|
static interface |
SoyFutureValueProvider.FutureBlockCallback
A callback that gets fired just before this provider will block on a future.
|
SoyAbstractCachingValueProvider.ValueAssertion| Modifier and Type | Field and Description |
|---|---|
static ThreadLocal<SoyFutureValueProvider.FutureBlockCallback> |
futureBlockCallback
Allows threads to register a
SoyFutureValueProvider.FutureBlockCallback. |
| Constructor and Description |
|---|
SoyFutureValueProvider(Future<?> future) |
| Modifier and Type | Method and Description |
|---|---|
protected SoyValue |
compute()
Calls Future.get() and then converts the result to SoyValue.
|
RenderResult |
status()
Returns
RenderResult.done() if the value provider can be resolved
without blocking on a future. |
addValueAssertion, hashCode, isComputed, renderAndResolve, resolvepublic static final ThreadLocal<SoyFutureValueProvider.FutureBlockCallback> futureBlockCallback
SoyFutureValueProvider.FutureBlockCallback.
When calling SoyAbstractCachingValueProvider.resolve() on this SoyFutureValueProvider, if the thread needs
to block on the future (because Future.isDone() is false), then it will call
the currently registered block callback immediately prior blocking. See RenderVisitor.exec for the motivating usecase for this hook.
Important: Do not use outside of Soy code (treat as superpackage-private).
public SoyFutureValueProvider(Future<?> future)
valueConverter - The instance of SoyValueConverter to use for converting the future value
(after retrieval).future - The underlying Future object.public RenderResult status()
SoyValueProviderRenderResult.done() if the value provider can be resolved
without blocking on a future. Otherwise, returns a RenderResult that holds the future.
Note, once this method returns RenderResult.done() all future calls must also return
RenderResult.done().
This method will never return a limited RenderResult
@Nonnull protected final SoyValue compute()
null, since null converts to NullData.INSTANCE.compute in class SoyAbstractCachingValueProvider