KEY - M - MB - public class RemoteRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>> extends AbstractRegistry<KEY,IdentifiableMessage<KEY,M,MB>,Map<KEY,IdentifiableMessage<KEY,M,MB>>,ProtoBufRegistry<KEY,M,MB>,RemoteRegistryPlugin<KEY,IdentifiableMessage<KEY,M,MB>,ProtoBufRegistry<KEY,M,MB>>> implements ProtoBufRegistry<KEY,M,MB>, org.openbase.jul.pattern.provider.DataProvider<Map<KEY,IdentifiableMessage<KEY,M,MB>>>
Shutdownable.ShutdownDeamonconsistent, logger, pluginPool, sandboxlatestValueHash, observers, unchangedValueFilterTYPE_FIELD_NAME| Constructor and Description |
|---|
RemoteRegistry() |
RemoteRegistry(Map<KEY,IdentifiableMessage<KEY,M,MB>> internalMap) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDataObserver(org.openbase.jul.pattern.Observer<Map<KEY,IdentifiableMessage<KEY,M,MB>>> observer) |
boolean |
contains(M entry) |
MB |
getBuilder(KEY key) |
Map<KEY,IdentifiableMessage<KEY,M,MB>> |
getData() |
File |
getDatabaseDirectory() |
Class<Map<KEY,IdentifiableMessage<KEY,M,MB>>> |
getDataClass() |
CompletableFuture<Map<KEY,IdentifiableMessage<KEY,M,MB>>> |
getDataFuture() |
Integer |
getDBVersion() |
KEY |
getId(M entry) |
M |
getMessage(KEY key) |
List<M> |
getMessages() |
protected RegistryRemote<?> |
getRegistryRemote()
Method returns the registry remote where this instance is bound to.
|
boolean |
isDataAvailable()
Check if the remote registry provides already valid data.
|
boolean |
isDataAvalable()
Deprecated.
please use isDataAvailable() instead
|
boolean |
isReadOnly() |
void |
loadRegistry() |
void |
notifyRegistryUpdate(Collection<M> values) |
boolean |
recursiveTryLockRegistry(Set<Registry> lockedRegistries)
Try to acquire the write lock for this registry and the registries it depends
on recursively.
|
M |
register(M entry) |
void |
registerConsistencyHandler(ConsistencyHandler<KEY,IdentifiableMessage<KEY,M,MB>,Map<KEY,IdentifiableMessage<KEY,M,MB>>,ProtoBufRegistry<KEY,M,MB>> consistencyHandler) |
void |
registerDependency(Registry registry)
If this registry depends on other registries, this method can be used to tell this registry all depending registries.
|
M |
remove(M entry) |
void |
removeDataObserver(org.openbase.jul.pattern.Observer<Map<KEY,IdentifiableMessage<KEY,M,MB>>> observer) |
void |
saveRegistry() |
void |
setRegistryRemote(RegistryRemote<?> remote) |
boolean |
tryLockRegistry()
Try to acquire the write lock for this registry.
|
void |
unlockRegistry()
Unlock the write lock of the registry.
|
M |
update(M entry) |
void |
waitForData()
Method blocks until the remote registry is synchronized.
|
void |
waitForData(long timeout,
TimeUnit timeUnit) |
void |
waitUntilReady()
Method blocks until the referred registry is not handling any tasks and is currently consistent.
|
Future<Void> |
waitUntilReadyFuture()
Method blocks until the registry is not handling any tasks and is currently consistent.
|
addDependencyObserver, afterConsistencyCheck, checkConsistency, checkWriteAccess, clear, contains, contains, finishTransaction, get, getEntries, getEntryMap, getEntryMapClass, getName, info, isBusy, isBusyByCurrentThread, isConsistent, isDependingOnConsistentRegistries, isEmpty, isReady, isSandbox, isWriteLockedByCurrentThread, load, lock, log, log, log, notifyObservers, register, registerPlugin, remove, remove, removeAllDependencies, removeConsistencyHandler, removeDependency, removeDependencyObserver, replaceInternalMap, replaceInternalMap, setName, setupSandbox, shutdown, size, superRemove, toString, unlock, update, verifyID, verifyIDapplyValueUpdate, getValue, getValueFuture, isValueAvailable, waitForValueaddObserver, isNotificationInProgess, notifyObservers, notifyObservers, removeObserver, setExecutorService, setHashGenerator, waitUntilNotificationIsFinishedclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddDependencyObserver, clear, contains, contains, get, get, getEntries, getEntryMap, getName, isConsistent, isEmpty, isEmtpy, isReady, isSandbox, register, remove, remove, removeDependencyObserver, size, updatecheckWriteAccess, isWritableaddObserver, getLatestValue, getValue, getValueFuture, isValueAvailable, removeObserver, waitForValue, waitForValueregisterShutdownHook, registerShutdownHook, shutdownpublic RemoteRegistry()
throws InstantiationException
InstantiationExceptionpublic RemoteRegistry(Map<KEY,IdentifiableMessage<KEY,M,MB>> internalMap) throws InstantiationException
InstantiationExceptionpublic void notifyRegistryUpdate(Collection<M> values) throws CouldNotPerformException
CouldNotPerformExceptionpublic KEY getId(M entry) throws CouldNotPerformException
CouldNotPerformExceptionpublic M getMessage(KEY key) throws CouldNotPerformException
getMessage in interface ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>CouldNotPerformExceptionpublic MB getBuilder(KEY key) throws CouldNotPerformException
getBuilder in interface ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>CouldNotPerformExceptionpublic M register(M entry) throws CouldNotPerformException
register in interface ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>CouldNotPerformExceptionpublic M update(M entry) throws CouldNotPerformException
update in interface ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>CouldNotPerformExceptionpublic M remove(M entry) throws CouldNotPerformException
remove in interface ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>CouldNotPerformExceptionpublic boolean contains(M entry) throws CouldNotPerformException
contains in interface ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>CouldNotPerformExceptionpublic void loadRegistry()
throws CouldNotPerformException
loadRegistry in interface FileSynchronizedRegistry<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>CouldNotPerformExceptionpublic void saveRegistry()
throws CouldNotPerformException
saveRegistry in interface FileSynchronizedRegistry<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>CouldNotPerformExceptionpublic List<M> getMessages() throws CouldNotPerformException
getMessages in interface ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>CouldNotPerformExceptionpublic Integer getDBVersion() throws NotAvailableException
getDBVersion in interface FileSynchronizedRegistry<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>NotAvailableExceptionpublic File getDatabaseDirectory() throws NotAvailableException
getDatabaseDirectory in interface FileSynchronizedRegistry<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>NotAvailableExceptionpublic void registerConsistencyHandler(ConsistencyHandler<KEY,IdentifiableMessage<KEY,M,MB>,Map<KEY,IdentifiableMessage<KEY,M,MB>>,ProtoBufRegistry<KEY,M,MB>> consistencyHandler) throws CouldNotPerformException
registerConsistencyHandler in class AbstractRegistry<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,Map<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>,ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,RemoteRegistryPlugin<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>>CouldNotPerformExceptionpublic void registerDependency(Registry registry) throws CouldNotPerformException
AbstractRegistryregisterDependency in class AbstractRegistry<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,Map<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>,ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,RemoteRegistryPlugin<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>>registry - the dependency of these registry.CouldNotPerformExceptionpublic boolean tryLockRegistry()
throws RejectedException
AbstractRegistrytryLockRegistry in interface Registry<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>tryLockRegistry in class AbstractRegistry<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,Map<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>,ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,RemoteRegistryPlugin<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>>RejectedException - If the registry does not support to be locked externally which is for example the case for remote registries.public boolean recursiveTryLockRegistry(Set<Registry> lockedRegistries) throws RejectedException
AbstractRegistryrecursiveTryLockRegistry in interface Registry<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>recursiveTryLockRegistry in class AbstractRegistry<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,Map<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>,ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,RemoteRegistryPlugin<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>>lockedRegistries - Set of already locked registries. Should be given empty to this method and will contain all locked registries afterwards.RejectedException - If the registry does not support to be locked externally which is for example the case for remote registries.public void unlockRegistry()
AbstractRegistryunlockRegistry in interface Registry<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>unlockRegistry in class AbstractRegistry<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,Map<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>,ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,RemoteRegistryPlugin<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>>public boolean isReadOnly()
AbstractRegistryisReadOnly in interface Registry<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>isReadOnly in class AbstractRegistry<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,Map<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>,ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,RemoteRegistryPlugin<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>,ProtoBufRegistry<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>>public void waitUntilReady()
throws InterruptedException,
CouldNotPerformException
InterruptedException - is thrown in case the thread was externally interrupted.CouldNotPerformException - is thrown if the wait could not be performed.public Future<Void> waitUntilReadyFuture()
public Map<KEY,IdentifiableMessage<KEY,M,MB>> getData() throws NotAvailableException
getData in interface org.openbase.jul.pattern.provider.DataProvider<Map<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>>NotAvailableExceptionpublic CompletableFuture<Map<KEY,IdentifiableMessage<KEY,M,MB>>> getDataFuture()
public void addDataObserver(org.openbase.jul.pattern.Observer<Map<KEY,IdentifiableMessage<KEY,M,MB>>> observer)
public void removeDataObserver(org.openbase.jul.pattern.Observer<Map<KEY,IdentifiableMessage<KEY,M,MB>>> observer)
public void waitForData()
throws InterruptedException
waitForData in interface org.openbase.jul.pattern.provider.DataProvider<Map<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>>InterruptedException - is thrown in case the thread is externally interrupted.public void waitForData(long timeout,
TimeUnit timeUnit)
throws CouldNotPerformException,
InterruptedException
waitForData in interface org.openbase.jul.pattern.provider.DataProvider<Map<KEY,IdentifiableMessage<KEY,M extends com.google.protobuf.GeneratedMessage,MB extends com.google.protobuf.GeneratedMessage.Builder<MB>>>>CouldNotPerformExceptionInterruptedExceptionpublic void setRegistryRemote(RegistryRemote<?> remote)
protected RegistryRemote<?> getRegistryRemote() throws NotAvailableException
NotAvailableException - Because this bound is optionally this method may throws an NotAvailableException in case the remote registry is independent of any registry remote.public boolean isDataAvailable()
@Deprecated public boolean isDataAvalable()
Copyright © 2015–2018 openbase.org. All rights reserved.