diff options
Diffstat (limited to 'netx/javax/jnlp/ServiceManager.java')
-rw-r--r-- | netx/javax/jnlp/ServiceManager.java | 64 |
1 files changed, 29 insertions, 35 deletions
diff --git a/netx/javax/jnlp/ServiceManager.java b/netx/javax/jnlp/ServiceManager.java index 7e6fb36..2f35a6f 100644 --- a/netx/javax/jnlp/ServiceManager.java +++ b/netx/javax/jnlp/ServiceManager.java @@ -1,54 +1,48 @@ - - - package javax.jnlp; import java.util.*; - public final class ServiceManager { - private static ServiceManagerStub stub = null; + private static ServiceManagerStub stub = null; - private static Map<String,Object> lookupTable - = new HashMap<String,Object>(); // ensure lookup is idempotent - - private ServiceManager() { - // says it can't be instantiated - } + private static Map<String, Object> lookupTable = new HashMap<String, Object>(); // ensure lookup is idempotent + private ServiceManager() { + // says it can't be instantiated + } - public static java.lang.Object lookup(java.lang.String name) throws UnavailableServiceException { - if (stub == null) - throw new UnavailableServiceException("service stub not set."); + public static java.lang.Object lookup(java.lang.String name) throws UnavailableServiceException { + if (stub == null) + throw new UnavailableServiceException("service stub not set."); - synchronized(lookupTable) { - Object result = lookupTable.get(name); + synchronized (lookupTable) { + Object result = lookupTable.get(name); - if (result == null) { - result = stub.lookup(name); - if (result != null) - lookupTable.put(name, result); - } + if (result == null) { + result = stub.lookup(name); + if (result != null) + lookupTable.put(name, result); + } - if (result == null) - throw new UnavailableServiceException("service not available (stub returned null)."); + if (result == null) + throw new UnavailableServiceException("service not available (stub returned null)."); - return result; + return result; + } } - } - public static java.lang.String[] getServiceNames() { - // should this return the required ones even though no stub?? - if (stub == null) - return new String[0]; + public static java.lang.String[] getServiceNames() { + // should this return the required ones even though no stub?? + if (stub == null) + return new String[0]; - return stub.getServiceNames(); - } + return stub.getServiceNames(); + } - public static void setServiceManagerStub(ServiceManagerStub stub) { - if (ServiceManager.stub == null) - ServiceManager.stub = stub; - } + public static void setServiceManagerStub(ServiceManagerStub stub) { + if (ServiceManager.stub == null) + ServiceManager.stub = stub; + } } |