Package com.tangosol.net
Class CompositeSocketAddressProvider
- java.lang.Object
-
- com.tangosol.net.CompositeSocketAddressProvider
-
- All Implemented Interfaces:
SocketAddressProvider
public class CompositeSocketAddressProvider extends Object implements 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
Constructors Constructor Description CompositeSocketAddressProvider(SocketAddressProvider provider)
Construct a CompositeSocketAddressProvider from the specifiedSocketAddressProvider
.CompositeSocketAddressProvider(SocketAddress address)
Construct a CompositeSocketAddressProvider from the specifiedSocketAddress
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.void
addAddress(SocketAddress address)
Add aSocketAddress
.void
addProvider(SocketAddressProvider provider)
Add aSocketAddressProvider
.SocketAddress
getNextAddress()
Obtain a next available address to use.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 theSocketAddressProvider.getNextAddress()
method has failed.String
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 Detail
-
CompositeSocketAddressProvider
public CompositeSocketAddressProvider(SocketAddress address)
Construct a CompositeSocketAddressProvider from the specifiedSocketAddress
.- Parameters:
address
- the initial wrappedSocketAddress
-
CompositeSocketAddressProvider
public CompositeSocketAddressProvider(SocketAddressProvider provider)
Construct a CompositeSocketAddressProvider from the specifiedSocketAddressProvider
.- Parameters:
provider
- the initial wrappedSocketAddressProvider
-
-
Method Detail
-
addAddress
public void addAddress(SocketAddress address)
Add aSocketAddress
.- Parameters:
address
- theSocketAddress
to add
-
addProvider
public void addProvider(SocketAddressProvider provider)
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
public 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 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
public 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'sSocketAddressProvider.accept()
method.- Specified by:
getNextAddress
in interfaceSocketAddressProvider
- Returns:
- the next available address or null if the list of available addresses was exhausted
-
-