X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=webservices%2Fcompbio%2Fws%2Fserver%2FRegistryWS.java;h=8be071ed94b1563bd4888f74205ad657f7312393;hb=184bf3dce9500c599b5257140ec49edd80f8cea1;hp=c54fc56b373e9ddd5777aebe5ab4402b3a6289a8;hpb=d92ac5284d2c918deda443f89e60cab6f0f8667e;p=jabaws.git diff --git a/webservices/compbio/ws/server/RegistryWS.java b/webservices/compbio/ws/server/RegistryWS.java index c54fc56..8be071e 100644 --- a/webservices/compbio/ws/server/RegistryWS.java +++ b/webservices/compbio/ws/server/RegistryWS.java @@ -57,6 +57,7 @@ public class RegistryWS implements compbio.data.msa.RegistryWS, JABAService { * Stores tested and passed (the test) services and their testing time */ private final static Map operating = new ConcurrentHashMap(); + private final static Map nonoperating = new ConcurrentHashMap(); /** * Indicate whether the services were tested at all @@ -68,7 +69,13 @@ public class RegistryWS implements compbio.data.msa.RegistryWS, JABAService { init(); return operating.keySet(); } - +/* FOR FUTURE RELEASES!!! + @Override + public Set getNonoperatedServices() { + init(); + return nonoperating.keySet(); + } +*/ private void init() { // Do not allow tests to run concurrently if (timeToTest()) { @@ -137,19 +144,19 @@ public class RegistryWS implements compbio.data.msa.RegistryWS, JABAService { Writer testlog = new StringWriter(); PrintWriter writer = new PrintWriter(testlog, true); WSTester tester = new WSTester(getServicePath(), writer); - // This is done deliberately to prevent malicious user from overloading - // the server + // This is done deliberately to prevent malicious user from overloading the server synchronized (operating) { for (Services service : Services.values()) { try { if (tester.checkService(service)) { operating.put(service, new Date()); + } else { + nonoperating.put(service, new Date()); } } catch (Exception e) { log.info(e, e.getCause()); - writer.println("Fails to connect to a web service: " - + service + " With " + e.getLocalizedMessage() - + "\nDetails: "); + String rep = "Fails to connect to a web service: " + service + " with"; + writer.println(rep + e.getLocalizedMessage() + "\nDetails: "); e.printStackTrace(writer); } } @@ -161,8 +168,7 @@ public class RegistryWS implements compbio.data.msa.RegistryWS, JABAService { private String getServicePath() { assert wsContext != null : "WS context injection failed!"; MessageContext msContext = wsContext.getMessageContext(); - HttpServletRequest request = (HttpServletRequest) msContext - .get(MessageContext.SERVLET_REQUEST); + HttpServletRequest request = (HttpServletRequest) msContext.get(MessageContext.SERVLET_REQUEST); StringBuffer server = request.getRequestURL(); server = server.delete(server.lastIndexOf("/"), server.length());