public class RegistrySynchronizationService
extends java.lang.Object
implements jadex.bridge.service.types.registry.IRegistrySynchronizationService, jadex.bridge.service.types.registry.IRegistryListener
Modifier and Type | Class and Description |
---|---|
static class |
RegistrySynchronizationService.SubscriptionInfo
Info struct for subscriptions.
|
Modifier and Type | Field and Description |
---|---|
protected jadex.bridge.IInternalAccess |
component
The component.
|
protected int |
eventslimit
The max number of events to collect before sending a bunch event.
|
protected java.util.Set<jadex.bridge.IComponentIdentifier> |
knownplatforms |
protected jadex.bridge.service.types.registry.RegistryEvent |
registryevent
The current registry event (is accumulated).
|
protected jadex.commons.collection.ILeaseTimeCollection<RegistrySynchronizationService.SubscriptionInfo> |
subscribedto
The platforms this registry has subscribed to.
|
protected java.util.Map<jadex.bridge.IComponentIdentifier,jadex.commons.future.SubscriptionIntermediateFuture<jadex.bridge.service.types.registry.IRegistryEvent>> |
subscriptions
The subscriptions of other platforms (platform cid -> subscription info).
|
protected long |
timelimit
The timelimit for sending events even when only few have arrived.
|
Constructor and Description |
---|
RegistrySynchronizationService() |
Modifier and Type | Method and Description |
---|---|
protected void |
addKnownPlatform(jadex.bridge.IComponentIdentifier cid)
Add a known platform.
|
protected void |
addSubscribedTo(RegistrySynchronizationService.SubscriptionInfo info)
Add a new subscription.
|
protected void |
addSubscription(jadex.bridge.IComponentIdentifier cid,
jadex.commons.future.SubscriptionIntermediateFuture<jadex.bridge.service.types.registry.IRegistryEvent> future)
Add a new subscription.
|
void |
destroy()
Called on shutdown.
|
protected jadex.bridge.service.search.IServiceRegistry |
getRegistry()
Get the registry.
|
protected jadex.commons.future.ISubscriptionIntermediateFuture<jadex.bridge.service.types.registry.IRegistryEvent> |
getSubscription(jadex.bridge.IComponentIdentifier cid)
Get a subscription.
|
protected boolean |
hasSubscription(jadex.bridge.IComponentIdentifier cid)
Test if has a subscription.
|
void |
init()
Start of the service.
|
protected boolean |
isKnownPlatform(jadex.bridge.IComponentIdentifier cid)
Test if has a subscription.
|
protected void |
newPlatformFound(jadex.bridge.IComponentIdentifier cid)
Called when a new platform was found.
|
protected void |
notifySubscribers()
Notify all subscribed platforms that an event has occurred.
|
void |
registryChanged(jadex.bridge.service.types.registry.RegistryListenerEvent event)
Listener method called on changes of the local registry.
|
protected void |
removeKnownPlatforms(jadex.bridge.IComponentIdentifier cid)
Remove an existing subscription.
|
protected void |
removeSubscribedTo(RegistrySynchronizationService.SubscriptionInfo info)
Remove an existing subscription.
|
protected void |
removeSubscription(jadex.bridge.IComponentIdentifier cid)
Remove an existing subscription.
|
jadex.commons.future.ISubscriptionIntermediateFuture<jadex.bridge.service.types.registry.IRegistryEvent> |
subscribeToEvents()
Others subscribe to change events of this registry.
|
protected jadex.bridge.IInternalAccess component
protected java.util.Map<jadex.bridge.IComponentIdentifier,jadex.commons.future.SubscriptionIntermediateFuture<jadex.bridge.service.types.registry.IRegistryEvent>> subscriptions
protected jadex.commons.collection.ILeaseTimeCollection<RegistrySynchronizationService.SubscriptionInfo> subscribedto
protected java.util.Set<jadex.bridge.IComponentIdentifier> knownplatforms
protected jadex.bridge.service.types.registry.RegistryEvent registryevent
protected int eventslimit
protected long timelimit
public void init()
protected void newPlatformFound(jadex.bridge.IComponentIdentifier cid)
public void registryChanged(jadex.bridge.service.types.registry.RegistryListenerEvent event)
registryChanged
in interface jadex.bridge.service.types.registry.IRegistryListener
public void destroy()
protected void notifySubscribers()
public jadex.commons.future.ISubscriptionIntermediateFuture<jadex.bridge.service.types.registry.IRegistryEvent> subscribeToEvents()
subscribeToEvents
in interface jadex.bridge.service.types.registry.IRegistrySynchronizationService
protected void addSubscription(jadex.bridge.IComponentIdentifier cid, jadex.commons.future.SubscriptionIntermediateFuture<jadex.bridge.service.types.registry.IRegistryEvent> future)
future
- The subscription future.si
- The subscription info.protected boolean hasSubscription(jadex.bridge.IComponentIdentifier cid)
future
- The subscription future.si
- The subscription info.protected void removeSubscription(jadex.bridge.IComponentIdentifier cid)
cid
- The component id to remove.protected jadex.commons.future.ISubscriptionIntermediateFuture<jadex.bridge.service.types.registry.IRegistryEvent> getSubscription(jadex.bridge.IComponentIdentifier cid)
future
- The subscription future.si
- The subscription info.protected void addSubscribedTo(RegistrySynchronizationService.SubscriptionInfo info)
future
- The subscription info.protected void removeSubscribedTo(RegistrySynchronizationService.SubscriptionInfo info)
cid
- The component id to remove.protected void addKnownPlatform(jadex.bridge.IComponentIdentifier cid)
future
- The subscription future.si
- The subscription info.protected boolean isKnownPlatform(jadex.bridge.IComponentIdentifier cid)
future
- The subscription future.si
- The subscription info.protected void removeKnownPlatforms(jadex.bridge.IComponentIdentifier cid)
cid
- The component id to remove.protected jadex.bridge.service.search.IServiceRegistry getRegistry()