public abstract class ReferralException extends NamingException
服务提供商提供的ReferralException子类提供getReferralInfo()和getReferralContext()实现(和适当的构造函数和/或相应的“集合”的方法)。
下面的代码示例演示如何ReferralException可。
while (true) { try { bindings = ctx.listBindings(name); while (bindings.hasMore()) { b = bindings.next(); ... } break; } catch (ReferralException e) { ctx = e.getReferralContext(); } }
ReferralException是一个抽象类。具体实现确定其同步和序列化属性。
环境参数传递给getReferralContext()方法是由调用方拥有。服务提供程序不会修改对象或保持引用它,但可以保留它的一个克隆的参考。
remainingName, resolvedName, resolvedObj, rootException
Modifier | Constructor and Description |
---|---|
protected |
ReferralException()
构建一个新的实例referralexception。
|
protected |
ReferralException(String explanation)
构建一个使用说明提供的referralexception新实例。
|
Modifier and Type | Method and Description |
---|---|
abstract Context |
getReferralContext()
检索继续该方法的上下文。
|
abstract Context |
getReferralContext(Hashtable<?,?> env)
检索使用环境属性的方法的上下文。
|
abstract Object |
getReferralInfo()
检索与此转介相关的信息(如网址)。
|
abstract void |
retryReferral()
重试的推荐目前正在处理。
|
abstract boolean |
skipReferral()
丢弃的转诊要处理。
|
appendRemainingComponent, appendRemainingName, getCause, getExplanation, getRemainingName, getResolvedName, getResolvedObj, getRootCause, initCause, setRemainingName, setResolvedName, setResolvedObj, setRootCause, toString, toString
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, printStackTrace, printStackTrace, printStackTrace, setStackTrace
protected ReferralException(String explanation)
explanation
-这个例外的附加细节。可以为空。
Throwable.getMessage()
protected ReferralException()
public abstract Object getReferralInfo()
public abstract Context getReferralContext() throws NamingException
要继续操作,客户端程序应重新调用使用相同参数的方法,如原始调用。
NamingException
-如果遇到一个命名的例外。调用
retryReferral()或
skipReferral()继续处理推荐。
public abstract Context getReferralContext(Hashtable<?,?> env) throws NamingException
推荐使用env上下文的环境性能。这种方法可以用来代替无参数的重载形式当调用者需要使用不同的环境特性为介语境。它可能需要这样做,例如,当它需要向所提交的服务器提供不同的身份验证信息,以创建转介上下文。
要继续操作,客户端程序应重新调用使用相同参数的方法,如原始调用。
env
-可能的空环境下使用检索查询上下文时。如果为空,没有环境属性将被使用。
NamingException
-如果遇到一个命名的例外。调用
retryReferral()或
skipReferral()继续处理推荐。
public abstract boolean skipReferral()
getReferralContext
让其他推荐的处理继续。下面的代码片段显示了一个典型的使用模式。
} catch (ReferralException e) { if (!shallIFollow(e.getReferralInfo())) { if (!e.skipReferral()) { return; } } ctx = e.getReferralContext(); }
public abstract void retryReferral()
getReferralContext
允许电流转诊进行重审。下面的代码片段显示了一个典型的使用模式。
} catch (ReferralException e) { while (true) { try { ctx = e.getReferralContext(env); break; } catch (NamingException ne) { if (! shallIRetry()) { return; } // modify environment properties (env), if necessary e.retryReferral(); } } }
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.