You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by al...@apache.org on 2020/01/20 04:10:41 UTC
[juddi] branch bug/JUDDI-937 created (now 07790a2)
This is an automated email from the ASF dual-hosted git repository.
alexoree pushed a change to branch bug/JUDDI-937
in repository https://gitbox.apache.org/repos/asf/juddi.git.
at 07790a2 JUDDI-937 this resolve the caching issue, needs a test case still
This branch includes the following new commits:
new 07790a2 JUDDI-937 this resolve the caching issue, needs a test case still
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org
[juddi] 01/01: JUDDI-937 this resolve the caching issue,
needs a test case still
Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
alexoree pushed a commit to branch bug/JUDDI-937
in repository https://gitbox.apache.org/repos/asf/juddi.git
commit 07790a220657525c85d446ed9427aa9ac3fac6ee
Author: Alex O'Ree <al...@apache.org>
AuthorDate: Sun Jan 19 23:10:38 2020 -0500
JUDDI-937 this resolve the caching issue, needs a test case still
---
.../juddi/v3/client/mapping/ServiceLocator.java | 62 ++++++++++++++++------
1 file changed, 46 insertions(+), 16 deletions(-)
diff --git a/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ServiceLocator.java b/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ServiceLocator.java
index e270761..8c77604 100644
--- a/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ServiceLocator.java
+++ b/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ServiceLocator.java
@@ -19,6 +19,7 @@ import java.net.URL;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
import javax.xml.namespace.QName;
@@ -46,7 +47,7 @@ import org.uddi.api_v3.BusinessService;
*/
public class ServiceLocator {
- private Log log = LogFactory.getLog(this.getClass());
+ private static final Log log = LogFactory.getLog(ServiceLocator.class);
private UDDIClerk clerk;
private Properties properties = new Properties();
@@ -54,7 +55,7 @@ public class ServiceLocator {
private String policy = null;
private SelectionPolicy selectionPolicy = null;
private URLLocalizer urlLocalizer = null;
-
+ private ConcurrentHashMap<String, Topology> simpleCache= null;
/**
* Requirement in the config is a clerk with access credentials to the UDDI server
* you want the locator to do lookups to. When a live cache is used the clerk
@@ -80,6 +81,14 @@ public class ServiceLocator {
this.properties = clerk.getUDDINode().getProperties();
}
+ /**
+ * Creates a new UDDIServiceCache, which brings up a new WebService Endpoint. This
+ * EndPoint will be called by the UDDI server if any service changes. A callback
+ * will result in cleaning the cache.
+ *
+ * @param baseCallbackURL
+ * @throws ConfigurationException
+ */
public ServiceLocator withCache(URL baseCallbackURL) throws ConfigurationException {
if (serviceCache == null) {
serviceCache = initCache(baseCallbackURL);
@@ -109,6 +118,14 @@ public class ServiceLocator {
}
return this;
}
+
+
+ public ServiceLocator withSimpleCache(){
+ if (simpleCache==null){
+ simpleCache= new ConcurrentHashMap<String, Topology>();
+ }
+ return this;
+ }
public UDDIServiceCache getUDDIServiceCache() {
return serviceCache;
@@ -174,6 +191,13 @@ public class ServiceLocator {
throw new ConfigurationException(e.getMessage(),e);
}
}
+
+ public void clearCaches(){
+ if (serviceCache!=null)
+ serviceCache.removeAll();
+ if (simpleCache!=null)
+ simpleCache.clear();
+ }
/**
*
@@ -182,7 +206,8 @@ public class ServiceLocator {
* @throws TransportException
*/
public void shutdown() throws RemoteException, ConfigurationException, TransportException {
- serviceCache.shutdown();
+ if (serviceCache!=null)
+ serviceCache.shutdown();
}
/**
* Looks up the Endpoints for a Service. If the cache is in use it will try to
@@ -199,21 +224,25 @@ public class ServiceLocator {
*/
public String lookupEndpoint(String serviceKey) throws RemoteException, ConfigurationException, TransportException {
Topology topology = null;
- if (serviceCache==null) { //nocache in use
+ if (simpleCache != null && simpleCache.containsKey(serviceKey)){
+ topology = simpleCache.get(serviceKey);
+ } else if (serviceCache==null) { //nocache in use
topology = lookupEndpointInUDDI(serviceKey);
} else { //with cache
//try to get it from the cache first
topology = serviceCache.lookupService(serviceKey);
- if (topology==null) { //not found in the cache
+ if (topology == null) { //not found in the cache
topology = lookupEndpointInUDDI(serviceKey);
}
}
- if (topology!=null && topology.getEprs().size() > 0) {
- String epr = getPolicy().select(topology);
- return epr;
- } else {
- return null;
- }
+ if (topology!=null && topology.getEprs().size() > 0) {
+ if (simpleCache!=null){
+ simpleCache.put(serviceKey,topology);
+ }
+ String epr = getPolicy().select(topology);
+ return epr;
+ }
+ return null;
}
/**
@@ -264,11 +293,13 @@ public class ServiceLocator {
log.debug("epr= " + url);
eprs.add(url);
} else if(AccessPointType.WSDL_DEPLOYMENT.toString().equals(accessPoint.getUseType())) {
- //do something here
- //try to open that wsdl, then grab the endpoints
+ //do something here
+ //try to open that wsdl, then grab the endpoints
+ //String url=fetchFromWsdl(accessPoint.getValue());
+
} else if(AccessPointType.BINDING_TEMPLATE.toString().equals(accessPoint.getUseType())) {
- //do something here
- //grab that binding template and use that address
+ //do something here
+ //grab that binding template and use that address
}
}
}
@@ -284,5 +315,4 @@ public class ServiceLocator {
}
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org