public class SDCache
extends java.lang.Object
| Constructor and Description |
|---|
SDCache() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(java.lang.String serviceType,
java.lang.String opName,
java.util.List<ServiceDescription> serviceDescriptions)
Add new services
|
boolean |
containsCache(java.lang.String serviceType,
java.lang.String opName)
Check cache has specific service
|
java.util.List<ServiceDescription> |
get(java.lang.String serviceType,
java.lang.String opName)
Get services with specific type and operation
|
int |
getMaxCacheSize()
Return max size of the cache
|
int |
getRefreshPeriod()
Return cache refresh period
|
ServiceDescription |
getServiceDescription(int registerId)
Return the service description
|
java.util.Set<java.lang.String> |
getServices()
Return available services
|
void |
refresh()
Refresh the cache
|
void |
remove(int registerId)
Remove service from cache with its register id
|
void |
remove(ServiceDescription service)
Remove a service from cache with its description
|
boolean |
remove(ServiceDescription service,
java.lang.String opName)
Remove a service from cache with its description and operation name
|
boolean |
remove(java.lang.String serviceType,
java.lang.String opName)
Remove a service from cache with its type and operation name
|
boolean |
remove(java.lang.String serviceType,
java.lang.String opName,
ServiceDescription service)
Remove a service from cache with its type, operation name and service description
|
void |
setMaxCacheSize(int maxCacheSize)
Set max size of the cache
|
boolean |
setRefreshPeriod(int refreshPeriod)
Set cache refresh period
|
int |
size()
Return current cahche size
|
boolean |
update(ServiceDescription oldService,
ServiceDescription newService,
java.lang.String opName)
Update services containing same operation with new service description
|
public int getRefreshPeriod()
public boolean setRefreshPeriod(int refreshPeriod)
refreshPeriod - the new refresh periodpublic java.util.Set<java.lang.String> getServices()
public int getMaxCacheSize()
public void setMaxCacheSize(int maxCacheSize)
maxCacheSize - the new max cahche sizepublic boolean add(java.lang.String serviceType,
java.lang.String opName,
java.util.List<ServiceDescription> serviceDescriptions)
serviceType - the service typeopName - the operation nameserviceDescriptions - new list of service descriptionspublic java.util.List<ServiceDescription> get(java.lang.String serviceType, java.lang.String opName)
serviceType - the service typeopName - the operation namepublic void remove(ServiceDescription service)
service - the service descriptionpublic boolean remove(java.lang.String serviceType,
java.lang.String opName)
serviceType - the service typeopName - the operation namepublic boolean remove(java.lang.String serviceType,
java.lang.String opName,
ServiceDescription service)
serviceType - the service typeopName - the operation nameservice - the service descriptionpublic boolean remove(ServiceDescription service, java.lang.String opName)
service - the service descriptionopName - the operation namepublic int size()
public boolean containsCache(java.lang.String serviceType,
java.lang.String opName)
serviceType - the service typeopName - the operation namepublic void refresh()
public boolean update(ServiceDescription oldService, ServiceDescription newService, java.lang.String opName)
oldService - the old service descriptionnewService - the new service descriptionopName - the operation namepublic ServiceDescription getServiceDescription(int registerId)
registerId - the service register idpublic void remove(int registerId)
registerId - the register id of a service to be removed