1 23 24 package com.sun.enterprise.deployment.backend; 25 26 import java.util.Collections ; 27 import java.util.Map ; 28 import java.util.HashMap ; 29 import java.util.Iterator ; 30 31 import com.sun.enterprise.util.i18n.StringManager; 32 33 40 public class DeploymentRequestRegistry { 41 42 static DeploymentRequestRegistry instance=null; 44 45 Map idToRequest = Collections.synchronizedMap(new HashMap ()); 47 48 49 private static StringManager localStrings = 50 StringManager.getManager( DeploymentRequestRegistry.class ); 51 52 53 private DeploymentRequestRegistry() { 54 } 55 56 59 public static DeploymentRequestRegistry getRegistry() { 60 if (instance==null) { 61 synchronized(DeploymentRequestRegistry.class) { 62 if (instance==null) { 63 instance = new DeploymentRequestRegistry(); 64 } 65 }; 66 } 67 return instance; 68 } 69 70 75 public void addDeploymentRequest(String id, 76 DeploymentRequest request) throws IASDeploymentException { 77 synchronized(DeploymentRequestRegistry.class) { 78 if (idToRequest.containsKey(id)) { 81 String msg = localStrings.getString( 82 "another_thread_access_same_module", 83 new Object []{ id }); 84 throw new IASDeploymentException(msg); 85 } 86 idToRequest.put(id, request); 87 } 88 } 89 90 94 public void removeDeploymentRequest(String id) { 95 idToRequest.remove(id); 96 } 97 98 99 102 public DeploymentRequest getDeploymentRequest(String id) { 103 return (DeploymentRequest) idToRequest.get(id); 104 } 105 } 106 | Popular Tags |