Interface SharedRdbInstanceProvider
public interface SharedRdbInstanceProvider
Provide a shared RhythmDatabase instance.
-
Method Summary
Modifier and TypeMethodDescriptionget()Get the initialized shared instance.static SharedRdbInstanceProviderGet the default implementation available in the global lookup.Future<?> Initialize the RhythmDatabase instance.booleanCheck if the RhythmDatabase instance is initialized.booleanCheck if a full refresh is planned for next startup.voidmarkForStartupRefresh(boolean b) Request or cancel a full refresh of the shared database upon next startup.
-
Method Details
-
getDefault
Get the default implementation available in the global lookup.- Returns:
- Can be null
-
initialize
Future<?> initialize()Initialize the RhythmDatabase instance.As the initialization can take some time (e.g. reading files), the implementation must launch a task in a different thread and return the corresponding Future so that caller can monitor completion.
- Returns:
-
isInitialized
boolean isInitialized()Check if the RhythmDatabase instance is initialized.- Returns:
-
get
RhythmDatabase get()Get the initialized shared instance.If initialization is not done, call initialize(). If initialization is not complete, wait for its completion.
- Returns:
- cannot be null
-
markForStartupRefresh
void markForStartupRefresh(boolean b) Request or cancel a full refresh of the shared database upon next startup.- Parameters:
b- Request if true, cancel if false
-
isMarkedForStartupRefresh
boolean isMarkedForStartupRefresh()Check if a full refresh is planned for next startup.- Returns:
-