|
Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
java.util.AbstractCollection
java.util.AbstractSet
com.tangosol.net.ConfigurableAddressProvider
public class ConfigurableAddressProvider
ConfigurableAddressProvider is an implementation of the AddressProvider interface based on a static list of addresses configured in an XML element that contains one or more items in the following format:
<socket-address> <address>...</address> <port>...</port> </socket-address>
The order of items in the configured list will be randomized to provide basic load balancing. <p/> This implementation is not thread safe.
| Nested Class Summary | |
|---|---|
protected class |
ConfigurableAddressProvider.AddressHolderA stateful holder for an obtaining an InetSocketAddress object. |
| Field Summary | |
|---|---|
protected boolean |
m_fSafeSpecifies if the provider is only to return resolved addresses. |
protected int |
m_iLastIndex of the last returned address. |
protected List |
m_listHoldersA list of AddressHolder objects. |
| Constructor Summary | |
|---|---|
ConfigurableAddressProvider(XmlElement xmlConfig)Construct an instance of ConfigurableAddressProvider based on the specified XML element. |
|
ConfigurableAddressProvider(XmlElement xmlConfig, boolean fSafe)Construct an instance of ConfigurableAddressProvider based on the specified XML element. |
|
| Method Summary | |
|---|---|
void |
accept()This method should be called by the client immediately after it determines that it can successfully use an address returned by the AddressProvider.getNextAddress() method. |
static AddressProvider |
createAddressProvider(XmlElement xmlConfig, ClassLoader loader)Instantiate an AddressProvider configured according to the specified XML. |
boolean |
equals(Object o)AddressProvider instances should compare to be equals() iff they should be expected to consistently produce the same resulting set of addresses. |
InetSocketAddress |
getNextAddress()Obtain a next available address to use. |
int |
hashCode()Return the hash code for this AddressProvider. |
Iterator |
iterator()Returns an iterator over the elements contained in this collection. |
void |
reject(Throwable eCause)This method should be called by the client immediately after it determines that an attempt to use an address returned by the AddressProvider.getNextAddress() method has failed. |
protected void |
reset()Reset the address provider making all previously returned addresses iterable. |
int |
size()Returns the number of elements in this collection. |
String |
toString()Return a string representation of this ConfigurableAddressProvider. |
| Methods inherited from class java.util.AbstractSet |
|---|
removeAll |
| Methods inherited from class java.util.AbstractCollection |
|---|
add, addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray |
| Methods inherited from interface java.util.Set |
|---|
add, addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray |
| Field Detail |
|---|
protected List m_listHolders
protected int m_iLast
protected boolean m_fSafe
| Constructor Detail |
|---|
public ConfigurableAddressProvider(XmlElement xmlConfig)
xmlConfig - the XML element that contains the configuration info
public ConfigurableAddressProvider(XmlElement xmlConfig,
boolean fSafe)
xmlConfig - the XML element that contains the configuration infofSafe - true if the provider is skips unresolved addresses| Method Detail |
|---|
public InetSocketAddress getNextAddress()
AddressProvider.accept() method.getNextAddress in interface AddressProviderpublic void accept()
AddressProvider.getNextAddress() method.accept in interface AddressProviderpublic void reject(Throwable eCause)
AddressProvider.getNextAddress() method has failed.reject in interface AddressProvidereCause - (optional) an exception that carries the reason why the the caller rejected the previously returned addresspublic int size()
size in interface Collectionsize in interface Setsize in class AbstractCollectionpublic Iterator iterator()
iterator in interface Iterableiterator in interface Collectioniterator in interface Setiterator in class AbstractCollectionprotected void reset()
public static AddressProvider createAddressProvider(XmlElement xmlConfig,
ClassLoader loader)
<!ELEMENT ... (socket-address+ | address-provider)>
<!ELEMENT address-provider
(class-name | (class-factory-name, method-name), init-params?>
<!ELEMENT socket-address (address, port)>
xmlConfig - the XML element that contains the configuration infoloader - (optional) the ClassLoader that should be used to load necessary classespublic boolean equals(Object o)
equals in interface AddressProviderequals in interface Collectionequals in interface Setequals in class AbstractSeto - the Object to compare this AddressProvider to for equalityObject.equals(Object), Set.equals(Object), List.equals(Object)public int hashCode()
hashCode in interface AddressProviderhashCode in interface CollectionhashCode in interface SethashCode in class AbstractSetObject.hashCode(), Object.equals(Object)public String toString()
toString in class AbstractCollection
|
Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||