Oracle® Coherence Java API Reference
v3.5

E14977-01

com.tangosol.net
Interface AddressProvider

All Known Implementing Classes:
CompositeAddressProvider, CompositeAddressProvider.SingleProvider, ConfigurableAddressProvider, RefreshableAddressProvider

public interface AddressProvider

The AddressProvider is an interface that serves as a means to provide addresses to a consumer. Simple implementations could be backed by a static list; more complex ones could use dynamic discovery protocols.

AddressProvider implementations must exercise extreme caution since any delay with return or unhandled exception will cause a delay or complete shutdown of the corresponding service.

Implementations that involve more expensive operations (e.g. network fetch) may choose to do so asychronously by extending RefreshableAddressProvider.

Since:
Coherence 3.4
Author:
gg,jh 2008-08-14

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 getNextAddress() method.
 boolean equals(java.lang.Object o)
          AddressProvider instances are considered equivalent iff they consistently produce the same resulting set of addresses.
 java.net.InetSocketAddress getNextAddress()
          Obtain a next available address to use.
 int hashCode()
          Return the hash code for this AddressProvider.
 void reject(java.lang.Throwable eCause)
          This method should be called by the client immediately after it determines that an attempt to use an address returned by the getNextAddress() method has failed.
 

Method Detail

getNextAddress

java.net.InetSocketAddress getNextAddress()
Obtain a next available address to use. If the caller can successfully use the returned address (e.g. a connection was established), it should call the AddressProvider's accept() method.

Returns:
the next available address or null if the list of available addresses was exhausted

accept

void accept()
This method should be called by the client immediately after it determines that it can successfully use an address returned by the getNextAddress() method.


reject

void reject(java.lang.Throwable eCause)
This method should be called by the client immediately after it determines that an attempt to use an address returned by the getNextAddress() method has failed.

Parameters:
eCause - (optional) an exception that carries the reason why the the caller rejected the previously returned address

equals

boolean equals(java.lang.Object o)
AddressProvider instances are considered equivalent iff they consistently produce the same resulting set of addresses.

Note: the general contract of hashCode and equals() should be preserved; AddressProviders that are "equal" should produce the same hashCode.

Parameters:
o - the Object to compare this AddressProvider to for equality
Returns:
true iff this AddressProvider is equal to the specified object

hashCode

int hashCode()
Return the hash code for this AddressProvider.

Returns:
the hash code for this AddressProvider

Oracle® Coherence Java API Reference
v3.5

E14977-01

Copyright © 2000, 2009, Oracle. All rights reserved.