/** * Get's the underlying model instance. * * @return Model instance */ default M get(final Duration duration) throws InterruptedException, ExecutionException, TimeoutException { return get().toCompletableFuture().get(duration.toMillis(), TimeUnit.MILLISECONDS); }
/** * Returns a blocking {@link PreLoader}. Blocks till the model is loaded or a {@link Duration} * is met. * * @param loader model loader. * @param duration Amount of time that it should wait, if necessary, for model to be loaded. * @param <M> Underlying model instance. */ static <M extends Model<?>> PreLoader<M> preload( final ModelLoader<M> loader, final Duration duration) throws InterruptedException, ExecutionException, TimeoutException { return ModelLoader.loaded(loader.get(duration))::get; }
final CompletableFuture<List<Prediction<InputT, ValueT>>> future = modelLoader .get() .thenCompose( model -> {