| Method from org.jnp.interfaces.NamingContext Detail: |
public void addNamingListener(Name target,
int scope,
NamingListener l) throws NamingException {
if((naming instanceof NamingEvents) == false)
{
throw new UnsupportedOperationException("Naming implementation does not support NamingExt");
}
NamingEvents next = (NamingEvents) naming;
try
{
next.addNamingListener(this, target, scope, l);
}
catch (RemoteException e)
{
CommunicationException ce = new CommunicationException("addNamingListener failed");
ce.initCause(e);
}
}
|
public void addNamingListener(String target,
int scope,
NamingListener l) throws NamingException {
Name targetName = parser.parse(target);
addNamingListener(targetName, scope, l);
}
|
static void addServer(String name,
Naming server) {
Object[] hostAndPort = {name, 0};
parseHostPort(name, hostAndPort, 0);
String host = (String) hostAndPort[HOST_INDEX];
Integer port = (Integer) hostAndPort[PORT_INDEX];
InetSocketAddress addr = new InetSocketAddress(host, port);
addServer(addr, server);
} Deprecated! use - #addServer(InetSocketAddress, Naming)
|
static void addServer(InetSocketAddress addr,
Naming server) {
// Add server to map
synchronized (NamingContext.class)
{
WeakReference< Naming > ref = new WeakReference< Naming >(server);
cachedServers.put(addr, ref);
}
}
|
public Object addToEnvironment(String propName,
Object propVal) throws NamingException {
Object old = env.get(propName);
env.put(propName, propVal);
return old;
}
|
public void bind(String name,
Object obj) throws NamingException {
bind(getNameParser(name).parse(name), obj);
}
|
public void bind(Name name,
Object obj) throws NamingException {
Hashtable refEnv = getEnv(name);
checkRef(refEnv);
Name parsedName = (Name) refEnv.get(JNP_PARSED_NAME);
if (parsedName != null)
name = parsedName;
// Allow state factories to change the stored object
obj = getStateToBind(obj, name, refEnv);
try
{
String className = null;
// Referenceable
if (obj instanceof Referenceable)
obj = ((Referenceable) obj).getReference();
if (!(obj instanceof Reference))
{
if( obj != null )
className = obj.getClass().getName();
// Normal object - serialize using a MarshalledValuePair
obj = createMarshalledValuePair(obj);
}
else
{
className = ((Reference) obj).getClassName();
}
name = getAbsoluteName(name);
try
{
naming.bind(name, obj, className);
}
catch (RemoteException re)
{
// Check for JBAS-4574.
if (handleStaleNamingStub(re, refEnv))
{
// try again with new naming stub
naming.bind(name, obj, className);
}
else
{
// Not JBAS-4574. Throw exception and let outer logic handle it.
throw re;
}
}
}
catch (CannotProceedException cpe)
{
cpe.setEnvironment(refEnv);
Context cctx = NamingManager.getContinuationContext(cpe);
cctx.bind(cpe.getRemainingName(), obj);
}
catch (IOException e)
{
naming = null;
removeServer(refEnv);
NamingException ex = new CommunicationException();
ex.setRootCause(e);
throw ex;
}
}
|
public void close() throws NamingException {
env = null;
naming = null;
}
|
public String composeName(String name,
String prefix) throws NamingException {
Name result = composeName(parser.parse(name),
parser.parse(prefix));
return result.toString();
}
|
public Name composeName(Name name,
Name prefix) throws NamingException {
Name result = (Name) (prefix.clone());
result.addAll(name);
return result;
}
|
public Context createSubcontext(String name) throws NamingException {
return createSubcontext(getNameParser(name).parse(name));
}
|
public Context createSubcontext(Name name) throws NamingException {
if (name.size() == 0)
throw new InvalidNameException("Cannot pass an empty name to createSubcontext");
Hashtable refEnv = getEnv(name);
checkRef(refEnv);
Name parsedName = (Name) refEnv.get(JNP_PARSED_NAME);
if (parsedName != null)
name = parsedName;
try
{
name = getAbsoluteName(name);
try
{
return naming.createSubcontext(name);
}
catch (RemoteException re)
{
// Check for JBAS-4574.
if (handleStaleNamingStub(re, refEnv))
{
// try again with new naming stub
return naming.createSubcontext(name);
}
else
{
// Not JBAS-4574. Throw exception and let outer logic handle it.
throw re;
}
}
}
catch (CannotProceedException cpe)
{
cpe.setEnvironment(refEnv);
Context cctx = NamingManager.getContinuationContext(cpe);
return cctx.createSubcontext(cpe.getRemainingName());
}
catch (IOException e)
{
naming = null;
removeServer(refEnv);
NamingException ex = new CommunicationException();
ex.setRootCause(e);
throw ex;
}
}
|
public void destroySubcontext(String name) throws NamingException {
destroySubcontext(getNameParser(name).parse(name));
}
|
public void destroySubcontext(Name name) throws NamingException {
if (!list(name).hasMore())
{
unbind(name);
}
else
throw new ContextNotEmptyException();
}
|
public Hashtable getEnvironment() throws NamingException {
return env;
}
|
public static Naming getHANamingServerForPartition(String partitionName) {
SecurityManager security = System.getSecurityManager();
if(security != null)
security.checkPermission(GET_HA_NAMING_SERVER);
return (Naming) haServers.get(partitionName);
}
|
public static Naming getLocal() {
SecurityManager security = System.getSecurityManager();
if(security != null)
security.checkPermission(GET_LOCAL_SERVER);
return localServer;
}
|
public String getNameInNamespace() throws NamingException {
return prefix.toString();
}
|
public NameParser getNameParser(String name) throws NamingException {
return parser;
}
|
public NameParser getNameParser(Name name) throws NamingException {
return getNameParser(name.toString());
}
|
public Naming getNaming() {
return this.naming;
}
|
static Naming getServer(String host,
int port,
Hashtable serverEnv) throws NamingException {
// Check the server cache for a host:port entry
InetSocketAddress key = new InetSocketAddress(host, port);
WeakReference< Naming > ref = cachedServers.get(key);
Naming server;
if (ref != null)
{
server = (Naming) ref.get();
if (server != null)
{
// JBAS-4622. Ensure the env for the request has the
// hostKey so we can remove the cache entry if there is a failure
serverEnv.put("hostKey", key);
return server;
}
}
// Server not found; add it to cache
try
{
SocketFactory factory = loadSocketFactory(serverEnv);
Socket s;
try
{
InetAddress localAddr = null;
int localPort = 0;
String localAddrStr = (String) serverEnv.get(JNP_LOCAL_ADDRESS);
String localPortStr = (String) serverEnv.get(JNP_LOCAL_PORT);
if (localAddrStr != null)
localAddr = InetAddress.getByName(localAddrStr);
if (localPortStr != null)
localPort = Integer.parseInt(localPortStr);
s = factory.createSocket(host, port, localAddr, localPort);
}
catch (IOException e)
{
NamingException ex = new ServiceUnavailableException("Failed to connect to server " + key);
ex.setRootCause(e);
throw ex;
}
// Get stub from naming server
BufferedInputStream bis = new BufferedInputStream(s.getInputStream());
ObjectInputStream in = new ObjectInputStream(bis);
MarshalledObject stub = (MarshalledObject) in.readObject();
server = (Naming) stub.get();
s.close();
// Add it to cache
addServer(key, server);
serverEnv.put("hostKey", key);
return server;
}
catch (IOException e)
{
if(log.isTraceEnabled())
log.trace("Failed to retrieve stub from server " + key, e);
NamingException ex = new CommunicationException("Failed to retrieve stub from server " + key);
ex.setRootCause(e);
throw ex;
}
catch (Exception e)
{
if(log.isTraceEnabled())
log.trace("Failed to connect server " + key, e);
NamingException ex = new CommunicationException("Failed to connect to server " + key);
ex.setRootCause(e);
throw ex;
}
}
|
public NamingEnumeration list(String name) throws NamingException {
return list(getNameParser(name).parse(name));
}
|
public NamingEnumeration list(Name name) throws NamingException {
Hashtable refEnv = getEnv(name);
checkRef(refEnv);
Name parsedName = (Name) refEnv.get(JNP_PARSED_NAME);
if (parsedName != null)
name = parsedName;
try
{
Collection c = null;
try
{
c = naming.list(getAbsoluteName(name));
}
catch (RemoteException re)
{
// Check for JBAS-4574.
if (handleStaleNamingStub(re, refEnv))
{
// try again with new naming stub
c = naming.list(getAbsoluteName(name));
}
else
{
// Not JBAS-4574. Throw exception and let outer logic handle it.
throw re;
}
}
return new NamingEnumerationImpl(c);
}
catch (CannotProceedException cpe)
{
cpe.setEnvironment(refEnv);
Context cctx = NamingManager.getContinuationContext(cpe);
return cctx.list(cpe.getRemainingName());
}
catch (IOException e)
{
naming = null;
removeServer(refEnv);
NamingException ex = new CommunicationException();
ex.setRootCause(e);
throw ex;
}
}
|
public NamingEnumeration listBindings(String name) throws NamingException {
return listBindings(getNameParser(name).parse(name));
}
|
public NamingEnumeration listBindings(Name name) throws NamingException {
Hashtable refEnv = getEnv(name);
checkRef(refEnv);
Name parsedName = (Name) refEnv.get(JNP_PARSED_NAME);
if (parsedName != null)
name = parsedName;
try
{
// Get list
Collection bindings = null;
try
{
// Get list
bindings = naming.listBindings(getAbsoluteName(name));
}
catch (RemoteException re)
{
// Check for JBAS-4574.
if (handleStaleNamingStub(re, refEnv))
{
// try again with new naming stub
bindings = naming.listBindings(getAbsoluteName(name));
}
else
{
// Not JBAS-4574. Throw exception and let outer logic handle it.
throw re;
}
}
Collection realBindings = new ArrayList(bindings.size());
// Convert marshalled objects
Iterator i = bindings.iterator();
while (i.hasNext())
{
Binding binding = (Binding) i.next();
Object obj = binding.getObject();
if (obj instanceof MarshalledValuePair)
{
try
{
obj = ((MarshalledValuePair) obj).get();
}
catch (ClassNotFoundException e)
{
NamingException ex = new CommunicationException();
ex.setRootCause(e);
throw ex;
}
}
else if (obj instanceof MarshalledObject)
{
try
{
obj = ((MarshalledObject) obj).get();
}
catch (ClassNotFoundException e)
{
NamingException ex = new CommunicationException();
ex.setRootCause(e);
throw ex;
}
}
realBindings.add(new Binding(binding.getName(), binding.getClassName(), obj));
}
// Return transformed list of bindings
return new NamingEnumerationImpl(realBindings);
}
catch (CannotProceedException cpe)
{
cpe.setEnvironment(refEnv);
Context cctx = NamingManager.getContinuationContext(cpe);
return cctx.listBindings(cpe.getRemainingName());
}
catch (IOException e)
{
naming = null;
removeServer(refEnv);
NamingException ex = new CommunicationException();
ex.setRootCause(e);
throw ex;
}
}
|
static SocketFactory loadSocketFactory(Hashtable serverEnv) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException {
SocketFactory factory = null;
// Get the socket factory classname
String socketFactoryName = (String) serverEnv.get(JNP_SOCKET_FACTORY);
if (socketFactoryName == null ||
socketFactoryName.equals(TimedSocketFactory.class.getName()))
{
factory = new TimedSocketFactory(serverEnv);
return factory;
}
/* Create the socket factory. Look for a ctor that accepts a
Hashtable and if not found use the default ctor.
*/
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Class factoryClass = loader.loadClass(socketFactoryName);
try
{
Class[] ctorSig = {Hashtable.class};
Constructor ctor = factoryClass.getConstructor(ctorSig);
Object[] ctorArgs = {serverEnv};
factory = (SocketFactory) ctor.newInstance(ctorArgs);
}
catch (NoSuchMethodException e)
{
// Use the default ctor
factory = (SocketFactory) factoryClass.newInstance();
}
return factory;
}
Create a SocketFactory based on the JNP_SOCKET_FACTORY property in the
given env. If JNP_SOCKET_FACTORY is not specified default to the
TimedSocketFactory. |
public Object lookup(String name) throws NamingException {
return lookup(getNameParser(name).parse(name));
}
|
public Object lookup(Name name) throws NamingException {
Hashtable refEnv = getEnv(name);
checkRef(refEnv);
Name parsedName = (Name) refEnv.get(JNP_PARSED_NAME);
if (parsedName != null)
name = parsedName;
// Empty?
if (name.isEmpty())
return new NamingContext(refEnv, prefix, naming);
try
{
int maxTries = 1;
try
{
String n = (String) refEnv.get(JNP_MAX_RETRIES);
if( n != null )
maxTries = Integer.parseInt(n);
if( maxTries < = 0 )
maxTries = 1;
}
catch(Exception e)
{
log.debug("Failed to get JNP_MAX_RETRIES, using 1", e);
}
Name n = getAbsoluteName(name);
Object res = null;
boolean trace = log.isTraceEnabled();
for (int i = 0; i < maxTries; i++)
{
try
{
try
{
res = naming.lookup(n);
}
catch (RemoteException re)
{
// Check for JBAS-4574.
if (handleStaleNamingStub(re, refEnv))
{
// try again with new naming stub
res = naming.lookup(n);
}
else
{
// Not JBAS-4574. Throw exception and let outer logic handle it.
throw re;
}
}
// If we got here, we succeeded, so break the loop
break;
}
catch (ConnectException ce)
{
int retries = maxTries - i - 1;
if( trace )
log.trace("Connect failed, retry count: "+retries, ce);
// We may overload server so sleep and retry
if (retries > 0)
{
try
{
Thread.sleep(1);
}
catch (InterruptedException ignored)
{
}
continue;
}
// Throw the exception to flush the bad server
throw ce;
}
}
if (res instanceof MarshalledValuePair)
{
MarshalledValuePair mvp = (MarshalledValuePair) res;
Object storedObj = mvp.get();
return getObjectInstanceWrapFailure(storedObj, name, refEnv);
}
else if (res instanceof MarshalledObject)
{
MarshalledObject mo = (MarshalledObject) res;
return mo.get();
}
else if (res instanceof Context)
{
// Add env
Enumeration keys = refEnv.keys();
while (keys.hasMoreElements())
{
String key = (String) keys.nextElement();
((Context) res).addToEnvironment(key, refEnv.get(key));
}
return res;
}
else if (res instanceof ResolveResult)
{
// Dereference partial result
ResolveResult rr = (ResolveResult) res;
Object resolveRes = rr.getResolvedObj();
Object context;
Object instanceID;
if (resolveRes instanceof LinkRef)
{
context = resolveLink(resolveRes, null);
instanceID = ((LinkRef) resolveRes).getLinkName();
}
else
{
context = getObjectInstanceWrapFailure(resolveRes, name, refEnv);
instanceID = context;
}
if ((context instanceof Context) == false)
{
throw new NotContextException(instanceID + " is not a Context");
}
Context ncontext = (Context) context;
return ncontext.lookup(rr.getRemainingName());
}
else if (res instanceof LinkRef)
{
// Dereference link
res = resolveLink(res, refEnv);
}
else if (res instanceof Reference)
{
// Dereference object
res = getObjectInstanceWrapFailure(res, name, refEnv);
if (res instanceof LinkRef)
res = resolveLink(res, refEnv);
}
return res;
}
catch (CannotProceedException cpe)
{
cpe.setEnvironment(refEnv);
Context cctx = NamingManager.getContinuationContext(cpe);
return cctx.lookup(cpe.getRemainingName());
}
catch (IOException e)
{
naming = null;
removeServer(refEnv);
NamingException ex = new CommunicationException();
ex.setRootCause(e);
throw ex;
}
catch (ClassNotFoundException e)
{
NamingException ex = new CommunicationException();
ex.setRootCause(e);
throw ex;
}
}
|
public Object lookupLink(String name) throws NamingException {
return lookupLink(getNameParser(name).parse(name));
}
|
public Object lookupLink(Name name) throws NamingException {
Hashtable refEnv = getEnv(name);
checkRef(refEnv);
Name parsedName = (Name) refEnv.get(JNP_PARSED_NAME);
if (parsedName != null)
name = parsedName;
if (name.isEmpty())
return lookup(name);
Object link = null;
try
{
Name n = getAbsoluteName(name);
try
{
link = naming.lookup(n);
}
catch (RemoteException re)
{
// Check for JBAS-4574.
if (handleStaleNamingStub(re, refEnv))
{
// try again with new naming stub
link = naming.lookup(n);
}
else
{
// Not JBAS-4574. Throw exception and let outer logic handle it.
throw re;
}
}
if (!(link instanceof LinkRef) && link instanceof Reference)
link = getObjectInstance(link, name, null);
;
}
catch (IOException e)
{
naming = null;
removeServer(refEnv);
NamingException ex = new CommunicationException();
ex.setRootCause(e);
throw ex;
}
catch (Exception e)
{
NamingException ex = new NamingException("Could not lookup link");
ex.setRemainingName(name);
ex.setRootCause(e);
throw ex;
}
return link;
}
Lookup the object referred to by name but don't dereferrence the final
component. This really just involves returning the raw value returned by
the Naming.lookup() method. |
static String parseNameForScheme(Name n,
Hashtable nameEnv) throws InvalidNameException {
String serverInfo = null;
if (n.size() > 0)
{
String scheme = n.get(0);
int schemeLength = 0;
if (scheme.startsWith("java:"))
schemeLength = 5;
else if (scheme.startsWith("jnp:"))
schemeLength = 4;
else if (scheme.startsWith("jnps:"))
schemeLength = 5;
else if (scheme.startsWith("jnp-http:"))
schemeLength = 9;
else if (scheme.startsWith("jnp-https:"))
schemeLength = 10;
if (schemeLength > 0)
{
// Make a copy of the name to avoid
n = (Name) n.clone();
String suffix = scheme.substring(schemeLength);
if (suffix.length() == 0)
{
// Scheme was "url:/..."
n.remove(0);
if (n.size() > 1 && n.get(0).equals(""))
{
// Scheme was "url://hostname:port/..."
// Get hostname:port value for the naming server
serverInfo = n.get(1);
n.remove(0);
n.remove(0);
// If n is a empty atom remove it or else a '/' will result
if (n.size() == 1 && n.get(0).length() == 0)
n.remove(0);
}
}
else
{
// Scheme was "url:foo" - > reinsert "foo"
n.remove(0);
n.add(0, suffix);
}
if (nameEnv != null)
nameEnv.put(JNP_PARSED_NAME, n);
}
}
return serverInfo;
}
Called to remove any url scheme atoms and extract the naming service
hostname:port information. |
public void rebind(String name,
Object obj) throws NamingException {
rebind(getNameParser(name).parse(name), obj);
}
|
public void rebind(Name name,
Object obj) throws NamingException {
Hashtable refEnv = getEnv(name);
checkRef(refEnv);
Name parsedName = (Name) refEnv.get(JNP_PARSED_NAME);
if (parsedName != null)
name = parsedName;
// Allow state factories to change the stored object
obj = getStateToBind(obj, name, refEnv);
try
{
String className = null;
// Referenceable
if (obj instanceof Referenceable)
obj = ((Referenceable) obj).getReference();
if (!(obj instanceof Reference))
{
if( obj != null )
className = obj.getClass().getName();
obj = createMarshalledValuePair(obj);
}
else
{
className = ((Reference) obj).getClassName();
}
try
{
naming.rebind(getAbsoluteName(name), obj, className);
}
catch (RemoteException re)
{
// Check for JBAS-4574.
if (handleStaleNamingStub(re, refEnv))
{
// try again with new naming stub
naming.rebind(getAbsoluteName(name), obj, className);
}
else
{
// Not JBAS-4574. Throw exception and let outer logic handle it.
throw re;
}
}
}
catch (CannotProceedException cpe)
{
cpe.setEnvironment(refEnv);
Context cctx = NamingManager.getContinuationContext(cpe);
cctx.rebind(cpe.getRemainingName(), obj);
}
catch (IOException e)
{
naming = null;
removeServer(refEnv);
NamingException ex = new CommunicationException();
ex.setRootCause(e);
throw ex;
}
}
|
public Object removeFromEnvironment(String propName) throws NamingException {
return env.remove(propName);
}
|
public static void removeHANamingServerForPartition(String partitionName) {
SecurityManager security = System.getSecurityManager();
if(security != null)
security.checkPermission(SET_HA_NAMING_SERVER);
haServers.remove(partitionName);
}
|
public void removeNamingListener(NamingListener l) throws NamingException {
if((naming instanceof NamingEvents) == false)
{
throw new UnsupportedOperationException("Naming implementation does not support NamingExt");
}
NamingEvents next = (NamingEvents) naming;
try
{
next.removeNamingListener(l);
}
catch (RemoteException e)
{
CommunicationException ce = new CommunicationException("removeNamingListener failed");
ce.initCause(e);
}
}
|
static void removeServer(Hashtable serverEnv) {
String host = "localhost";
int port = 1099;
// Locate naming service
if (serverEnv.get(Context.PROVIDER_URL) != null)
{
String providerURL = (String) serverEnv.get(Context.PROVIDER_URL);
StringTokenizer tokenizer = new StringTokenizer(providerURL, ", ");
while (tokenizer.hasMoreElements())
{
String url = tokenizer.nextToken();
try
{
// Parse the url into a host:port form, stripping any protocol
Name urlAsName = new NamingParser().parse(url);
String server = parseNameForScheme(urlAsName, null);
if (server != null)
url = server;
Object[] hostAndPort = {url, 1099};
parseHostPort(url, hostAndPort, 1099);
host = (String) hostAndPort[HOST_INDEX];
port = (Integer) hostAndPort[PORT_INDEX];
// Remove server from map
synchronized (NamingContext.class)
{
InetSocketAddress key = new InetSocketAddress(host, port);
cachedServers.remove(key);
}
}
catch (NamingException ignored)
{
}
}
}
// JBAS-4622. Always do this.
Object hostKey = serverEnv.remove("hostKey");
if (hostKey != null)
{
synchronized (NamingContext.class)
{
cachedServers.remove(hostKey);
}
}
}
|
public void rename(String oldname,
String newname) throws NamingException {
rename(getNameParser(oldname).parse(oldname), getNameParser(newname).parse(newname));
}
|
public void rename(Name oldName,
Name newName) throws NamingException {
bind(newName, lookup(oldName));
unbind(oldName);
}
|
protected Object resolveLink(Object res,
Hashtable refEnv) throws NamingException {
Object linkResult = null;
try
{
LinkRef link = (LinkRef) res;
String ref = link.getLinkName();
if (ref.startsWith("./"))
linkResult = lookup(ref.substring(2));
else if (refEnv != null)
linkResult = new InitialContext(refEnv).lookup(ref);
else
linkResult = new InitialContext().lookup(ref);
}
catch (Exception e)
{
NamingException ex = new NamingException("Could not dereference object");
ex.setRootCause(e);
throw ex;
}
return linkResult;
}
|
public static void setHANamingServerForPartition(String partitionName,
Naming haServer) {
SecurityManager security = System.getSecurityManager();
if(security != null)
security.checkPermission(SET_HA_NAMING_SERVER);
haServers.put(partitionName, haServer);
}
|
public static void setLocal(Naming server) {
SecurityManager security = System.getSecurityManager();
if(security != null)
security.checkPermission(SET_LOCAL_SERVER);
localServer = server;
}
|
public void setNaming(Naming server) {
this.naming = server;
}
|
protected boolean shouldDiscoveryHappen(boolean globalDisableDiscovery,
String perCtxDisableDiscovery) {
boolean trace = log.isTraceEnabled();
if (!globalDisableDiscovery)
{
// No global disable, so act as before.
if (Boolean.valueOf(perCtxDisableDiscovery) == Boolean.TRUE)
{
if (trace)
log.trace("Skipping discovery due to disable flag in context");
return false;
}
}
else
{
// Global disable on but double check whether there's a per context override.
// If disableDiscovery in context is explicitly set to false, do discovery.
if (perCtxDisableDiscovery == null || Boolean.valueOf(perCtxDisableDiscovery) == Boolean.TRUE)
{
if (trace)
log.trace("Skipping discovery due to disable flag in context, or disable flag globally (and no override in context)");
return false;
}
}
return true;
}
|
public boolean targetMustExist() throws NamingException {
if((naming instanceof NamingEvents) == false)
{
throw new UnsupportedOperationException("Naming implementation does not support NamingExt");
}
NamingEvents next = (NamingEvents) naming;
boolean targetMustExist = true;
try
{
targetMustExist = next.targetMustExist();
}
catch (RemoteException e)
{
CommunicationException ce = new CommunicationException("removeNamingListener failed");
ce.initCause(e);
}
return targetMustExist;
}
|
public void unbind(String name) throws NamingException {
unbind(getNameParser(name).parse(name));
}
|
public void unbind(Name name) throws NamingException {
Hashtable refEnv = getEnv(name);
checkRef(refEnv);
Name parsedName = (Name) refEnv.get(JNP_PARSED_NAME);
if (parsedName != null)
name = parsedName;
try
{
try
{
naming.unbind(getAbsoluteName(name));
}
catch (RemoteException re)
{
// Check for JBAS-4574.
if (handleStaleNamingStub(re, refEnv))
{
// try again with new naming stub
naming.unbind(getAbsoluteName(name));
}
else
{
// Not JBAS-4574. Throw exception and let outer logic handle it.
throw re;
}
}
}
catch (CannotProceedException cpe)
{
cpe.setEnvironment(refEnv);
Context cctx = NamingManager.getContinuationContext(cpe);
cctx.unbind(cpe.getRemainingName());
}
catch (IOException e)
{
naming = null;
removeServer(refEnv);
NamingException ex = new CommunicationException();
ex.setRootCause(e);
throw ex;
}
}
|