Package com.spotify.zoltar
Interface ModelLoader.PreLoader<M extends Model<?>>
-
- Type Parameters:
M
- Model instance type.
- All Superinterfaces:
AutoCloseable
,Closeable
,ModelLoader<M>
- Enclosing interface:
- ModelLoader<M extends Model<?>>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public static interface ModelLoader.PreLoader<M extends Model<?>> extends ModelLoader<M>
PreLoader is model loader that callsModelLoader.get()
allowing model preloading.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.spotify.zoltar.ModelLoader
ModelLoader.ConsLoader<M extends Model<?>>, ModelLoader.PreLoader<M extends Model<?>>, ModelLoader.ThrowableSupplier<M extends Model<?>>
-
-
Field Summary
-
Fields inherited from interface com.spotify.zoltar.ModelLoader
DEFAULT_EXECUTOR_SERVICE
-
-
Method Summary
Static Methods Modifier and Type Method Description static <M extends Model<?>>
ModelLoader.PreLoader<M>preload(ModelLoader.ThrowableSupplier<M> supplier, Duration duration, Executor executor)
Returns a blockingModelLoader
.static <M extends Model<?>>
ModelLoader.PreLoader<M>preload(ModelLoader<M> loader, Duration duration)
Returns a blockingModelLoader.PreLoader
.static <M extends Model<?>>
Function<ModelLoader<M>,ModelLoader.PreLoader<M>>preload(Duration duration)
Returns a blockingModelLoader.PreLoader
.
-
-
-
Method Detail
-
preload
static <M extends Model<?>> ModelLoader.PreLoader<M> preload(ModelLoader.ThrowableSupplier<M> supplier, Duration duration, Executor executor) throws InterruptedException, ExecutionException, TimeoutException
Returns a blockingModelLoader
. Blocks till the model is loaded or aDuration
is met.- Type Parameters:
M
- Underlying model instance.- Parameters:
supplier
- model supplier.duration
- Amount of time that it should wait, if necessary, for model to be loaded.executor
- the executor to use for asynchronous execution.- Throws:
InterruptedException
ExecutionException
TimeoutException
-
preload
static <M extends Model<?>> ModelLoader.PreLoader<M> preload(ModelLoader<M> loader, Duration duration) throws InterruptedException, ExecutionException, TimeoutException
Returns a blockingModelLoader.PreLoader
. Blocks till the model is loaded or aDuration
is met.- Type Parameters:
M
- Underlying model instance.- Parameters:
loader
- model loader.duration
- Amount of time that it should wait, if necessary, for model to be loaded.- Throws:
InterruptedException
ExecutionException
TimeoutException
-
preload
static <M extends Model<?>> Function<ModelLoader<M>,ModelLoader.PreLoader<M>> preload(Duration duration)
Returns a blockingModelLoader.PreLoader
. Blocks till the model is loaded or aDuration
is met.- Parameters:
duration
- Amount of time that it should wait, if necessary, for model to be loaded.
-
-