Interface AsyncDataProvider.Loader<T>
- Type Parameters:
T
- data provider model type
- Enclosing class:
- AsyncDataProvider<T>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
AsyncDataProvider
.-
Method Summary
-
Method Details
-
load
Perform a load operation.This method runs in a background thread; in particular, no
VaadinSession
will be locked.Note: This method returns a
Stream
but theStream
is not actually consumed in the background thread; that operation occurs later, in a different thread with theVaadinSession
locked. In cases where this matters (e.g., the data is gathered in a per-thread transaction), this method may need to proactively pull the data into memory ahead of time.This method should be prepared to handle an interrupt if/when
AsyncDataProvider.cancel()
is invoked; in that case this method may throwInterruptedException
. This method may also cancel itself by throwing an unpromptedInterruptedException
.If this method returns null, the load fails with an
IllegalArgumentException
.- Parameters:
id
- unique ID for this load attempt- Returns:
- stream of data items
- Throws:
InterruptedException
- if the current thread is interruptedRuntimeException
- if an error occurs during loading
-