Package com.tangosol.net
Interface SocketAddressProvider
-
- All Known Subinterfaces:
AddressProvider,DescribableAddressProvider
- All Known Implementing Classes:
CompositeAddressProvider,CompositeAddressProvider.SingleProvider,CompositeSocketAddressProvider,ConfigurableAddressProvider,ConfigurableLocalAddressProvider,NullImplementation.NullAddressProvider,RefreshableAddressProvider
public interface SocketAddressProviderThe SocketAddressProvider 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.SocketAddressProvider 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 asynchronously by extending
RefreshableAddressProvider.- Since:
- Coherence 12.1.2
- Author:
- gg,jh 2008.08.14, phf 2012.04.05
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaccept()This method should be called by the client immediately after it determines that it can successfully use an address returned by thegetNextAddress()method.booleanequals(Object o)SocketAddressProvider instances are considered equivalent iff they consistently produce the same resulting set of addresses.SocketAddressgetNextAddress()Obtain a next available address to use.inthashCode()Return the hash code for this SocketAddressProvider.voidreject(Throwable eCause)This method should be called by the client immediately after it determines that an attempt to use an address returned by thegetNextAddress()method has failed.
-
-
-
Method Detail
-
getNextAddress
SocketAddress 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 SocketAddressProvider'saccept()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 thegetNextAddress()method.
-
reject
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 thegetNextAddress()method has failed.- Parameters:
eCause- (optional) an exception that carries the reason why the the caller rejected the previously returned address
-
equals
boolean equals(Object o)
SocketAddressProvider 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.
-
-