Class GlobalRegistryCache
java.lang.Object
de.aristaflow.adept2.base.globalregistry.GlobalRegistryCache
A cache for all information from the global registry to prevent expensive
look-ups in the global registry. Users should invalidate the local URIs of a
service in case they find it to be invalid.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe mapping from global service URIs to the corresponding locally exported URIs.The mapping from each global URI to the corresponding service name.protected final ReadWriteLockThe lock for synchronising access to the data structures.The mapping from service name (type and instance name) to the corresponding globally exported URIs.The mapping from service name (type and instance name) to the corresponding locally exported URIs. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAndRenew(URI globUri, List<URI> locUris) Adds the locally exported URIs of the designated service identified by one of its global URIs and renews the local URIs.getGlobalServiceUris(String servType, String servName) Gets the URIs with which the designated service can be reached globally (via the global registry).getLocalServiceUris(String servType, String servName) Gets the URIs with which the designated service has been exported locally.getLocalServiceUris(URI globUri) Gets the URIs with which the designated service has been exported locally.getLocalServiceUris(List<URI> globUris) Gets the URIs with which the designated service has been exported locally.voidInvalidates all local URIs in this cache.voidinvalidateService(String servType, String servName) Invalidates the local URIs of the designated service and removes them from this cache.voidinvalidateService(List<URI> globUris) Invalidates the local URIs of the service with the designated global URIs and removes them from this cache.voidinvalidateUri(URI globUri) Invalidates the local URIs of the service with the designated global URI and removes them from this cache.voidAdds the designated service information to the cache.voidRenews the locally exported URIs of the designated service identified by its name.voidRenews the locally exported URIs of the designated service identified by its global URIs.
-
Field Details
-
nameLocalUris
The mapping from service name (type and instance name) to the corresponding locally exported URIs. -
nameGlobalUris
The mapping from service name (type and instance name) to the corresponding globally exported URIs. These are not invalidated. -
globalLocalUris
The mapping from global service URIs to the corresponding locally exported URIs. -
globalNames
The mapping from each global URI to the corresponding service name. These are not invalidated. -
lock
The lock for synchronising access to the data structures.
-
-
Constructor Details
-
GlobalRegistryCache
public GlobalRegistryCache()Creates a new cache with empty data structures.
-
-
Method Details
-
publishService
Adds the designated service information to the cache. This is called right after a service has been published in the global registry.- Parameters:
servType- The service type name of the published service.servName- The (simple) name of the published service.globUris- The URIs the service can be reached globally (via the global registry).locUris- The URIs the service has been exported locally.
-
renew
Renews the locally exported URIs of the designated service identified by its name. This only works for apublishedservice.- Parameters:
servType- The service type name of the published service.servName- The (simple) name of the published service.locUris- The URIs the service has been exported locally.
-
renew
Renews the locally exported URIs of the designated service identified by its global URIs. This only works for apublishedservice.- Parameters:
globUris- The URIs the service can be reached globally (via the global registry).locUris- The URIs the service has been exported locally.
-
addAndRenew
Adds the locally exported URIs of the designated service identified by one of its global URIs and renews the local URIs. This only works for apublishedservice.- Parameters:
globUri- One of the URIs the service can be reached globally (via the global registry).locUris- The URIs the service has been exported locally.
-
getGlobalServiceUris
Gets the URIs with which the designated service can be reached globally (via the global registry). This only works for apublishedservice.- Parameters:
servType- The service type name of the published service for which to get its global URIs.servName- The (simple) name of the published service for which to get its global URIs.- Returns:
- The URIs the service can be reached globally (via the global
registry). If the service is not known,
nullwill be returned.
-
getLocalServiceUris
Gets the URIs with which the designated service has been exported locally. This only works for apublishedservice.- Parameters:
servType- The service type name of the published service for which to get its local URIs.servName- The (simple) name of the published service for which to get its local URIs.- Returns:
- The URIs the service has been exported locally. If the service is
not known,
nullwill be returned.
-
getLocalServiceUris
Gets the URIs with which the designated service has been exported locally. This only works for apublishedservice.- Parameters:
globUris- The URIs the service can be reached globally (via the global registry).- Returns:
- The URIs the service has been exported locally. If the service is
not known,
nullwill be returned.
-
getLocalServiceUris
Gets the URIs with which the designated service has been exported locally. This only works for apublishedservice.- Parameters:
globUri- One of the URIs of a service that can be reached globally (via the global registry).- Returns:
- The URIs the service has been exported locally. If the service is
not known,
nullwill be returned.
-
invalidateUri
Invalidates the local URIs of the service with the designated global URI and removes them from this cache.- Parameters:
globUri- One of the URIs of a service which that can be reached globally (via the global registry) and of which to remove its local URIs from this cache.
-
invalidateService
Invalidates the local URIs of the designated service and removes them from this cache.- Parameters:
servType- The service type name of the published service of which to remove its local URIs from this cache.servName- The (simple) name of the published service of which to remove its local URIs from this cache.
-
invalidateService
Invalidates the local URIs of the service with the designated global URIs and removes them from this cache.- Parameters:
globUris- The URIs the service can be reached globally (via the global registry) and of which to remove its local URIs from this cache.
-
invalidateAll
public void invalidateAll()Invalidates all local URIs in this cache.
-