|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.crankuptheamps.client.DefaultServerChooser
public class DefaultServerChooser
A simple ServerChooser that keeps a list of AMPS instances and Authenticators, and advances to the next one when failure occurs.
| Constructor Summary | |
|---|---|
DefaultServerChooser()
|
|
| Method Summary | |
|---|---|
DefaultServerChooser |
add(String uri)
Adds a URI to self. |
Authenticator |
getCurrentAuthenticator()
Returns the Authenticator instance associated with the current URI. |
String |
getCurrentURI()
Returns the current URI. |
String |
getError()
Provides additional detail to be included in an exception thrown when the AMPS instance(s) are not available. |
void |
next()
Advances the server chooser to the next server it deems appropriate to connect with. |
void |
reportFailure(Exception exception,
ConnectionInfo info)
Called by the HAClient when an error occurs connecting to the
current URI, and/or when an error occurs logging on. |
void |
reportSuccess(ConnectionInfo info)
Called by the HAClient when successfully connected and logged on
to the current instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultServerChooser()
| Method Detail |
|---|
public DefaultServerChooser add(String uri)
uri - The AMPS URI to add to the list.public String getCurrentURI()
ServerChooser
getCurrentURI in interface ServerChooserpublic Authenticator getCurrentAuthenticator()
ServerChooser
getCurrentAuthenticator in interface ServerChooserAuthenticator or null if none is required for
logon.
public void reportFailure(Exception exception,
ConnectionInfo info)
ServerChooserHAClient when an error occurs connecting to the
current URI, and/or when an error occurs logging on. Implementors will
likely advance the current URI to the next one in a list, or choose to
stay with the current one, based on the exception type.
reportFailure in interface ServerChooserexception - The exception associated with this failure.info - Information about the connection that failed.public void reportSuccess(ConnectionInfo info)
ServerChooserHAClient when successfully connected and logged on
to the current instance.
reportSuccess in interface ServerChooserinfo - Information about the successful connection.public void next()
ServerChooser
next in interface ServerChooserpublic String getError()
ServerChooserHAClient
when creating an exception.
getError in interface ServerChooserString with information about the connection
that failed and the reason for the failure. When no
further information is available, returns an empty string.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||