Package com.tangosol.net
Class CompositeSocketAddressProvider
java.lang.Object
com.tangosol.net.CompositeSocketAddressProvider
- All Implemented Interfaces:
SocketAddressProvider
CompositeSocketAddressProvider is a composite of one or more
SocketAddressProviders. This SocketAddressProvider will provide addresses from
all registered providers or addresses.
- Since:
- Coherence 12.1.2
- Author:
- phf 2012.03.05
-
Constructor Summary
ConstructorDescriptionConstruct a CompositeSocketAddressProvider from the specifiedSocketAddressProvider
.Construct a CompositeSocketAddressProvider from the specifiedSocketAddress
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept()
This method should be called by the client immediately after it determines that it can successfully use an address returned by theSocketAddressProvider.getNextAddress()
method.void
addAddress
(SocketAddress address) Add aSocketAddress
.void
addProvider
(SocketAddressProvider provider) Add aSocketAddressProvider
.Obtain a next available address to use.void
This method should be called by the client immediately after it determines that an attempt to use an address returned by theSocketAddressProvider.getNextAddress()
method has failed.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.tangosol.net.SocketAddressProvider
equals, hashCode
-
Constructor Details
-
CompositeSocketAddressProvider
Construct a CompositeSocketAddressProvider from the specifiedSocketAddress
.- Parameters:
address
- the initial wrappedSocketAddress
-
CompositeSocketAddressProvider
Construct a CompositeSocketAddressProvider from the specifiedSocketAddressProvider
.- Parameters:
provider
- the initial wrappedSocketAddressProvider
-
-
Method Details
-
addAddress
Add aSocketAddress
.- Parameters:
address
- theSocketAddress
to add
-
addProvider
Add aSocketAddressProvider
.- Parameters:
provider
- theSocketAddressProvider
to add
-
accept
public void accept()This method should be called by the client immediately after it determines that it can successfully use an address returned by theSocketAddressProvider.getNextAddress()
method.- Specified by:
accept
in interfaceSocketAddressProvider
-
reject
This method should be called by the client immediately after it determines that an attempt to use an address returned by theSocketAddressProvider.getNextAddress()
method has failed.- Specified by:
reject
in interfaceSocketAddressProvider
- Parameters:
eCause
- (optional) an exception that carries the reason why the the caller rejected the previously returned address
-
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'sSocketAddressProvider.accept()
method.- Specified by:
getNextAddress
in interfaceSocketAddressProvider
- Returns:
- the next available address or null if the list of available addresses was exhausted
-
toString
-