Class LocalAddressProviderBuilder
- java.lang.Object
-
- com.tangosol.coherence.config.builder.LocalAddressProviderBuilder
-
- All Implemented Interfaces:
AddressProviderBuilder
,ParameterizedBuilder<AddressProvider>
,AddressProviderFactory
public class LocalAddressProviderBuilder extends Object implements AddressProviderBuilder
This class builds an AddressProviderBuilder from a local address. All ConfigurationExceptions are deferred until realization time.- Since:
- Coherence 12.2.1
- Author:
- jf 2015.02.26
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.tangosol.coherence.config.builder.ParameterizedBuilder
ParameterizedBuilder.ReflectionSupport
-
-
Constructor Summary
Constructors Constructor Description LocalAddressProviderBuilder(String sAddr, int nPortMin, int nPortMax)
ConstructsLocalAddressProviderBuilder
deferring address resolution until realized.LocalAddressProviderBuilder(String sAddr, int nPortMin, int nPortMax, XmlElement xmlConfig)
ConstructsLocalAddressProviderBuilder
deferring address resolution until realized.LocalAddressProviderBuilder(InetAddress addr, int nPortMin, int nPortMax)
ConstructsLocalAddressProviderBuilder
with a resolved address.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AddressProvider
createAddressProvider(ClassLoader loader)
Create a new AddressProvider using the specified class loader.int
getPortMin()
Return the minimum port number.int
getPortMinOriginal()
Return the minimum port number provided in the constructor.AddressProvider
realize(ParameterResolver resolver, ClassLoader loader, ParameterList listParameters)
Realizes (creates if necessary) an instance of a object of type T, using the providedParameterResolver
to resolve values any referencedParameter
s.InetAddress
resolveAddress()
Resolve the host address if provided as a string and cache the value.LocalAddressProviderBuilder
setAddress(InetAddress addr)
Set the address to use for any realizedAddressProvider
'sLocalAddressProviderBuilder
setPortMax(int nPort)
Set the maximum port number.LocalAddressProviderBuilder
setPortMin(int nPort)
Set the minimum port number.
-
-
-
Field Detail
-
MIN_PORT
public static final int MIN_PORT
- See Also:
- Constant Field Values
-
MAX_PORT
public static final int MAX_PORT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LocalAddressProviderBuilder
public LocalAddressProviderBuilder(InetAddress addr, int nPortMin, int nPortMax)
ConstructsLocalAddressProviderBuilder
with a resolved address.- Parameters:
addr
- the local address, or nullnPortMin
- the minimum port to use, or -1 to use ephemeral sub-portsnPortMax
- the maximum port to use
-
LocalAddressProviderBuilder
public LocalAddressProviderBuilder(String sAddr, int nPortMin, int nPortMax, XmlElement xmlConfig)
ConstructsLocalAddressProviderBuilder
deferring address resolution until realized.- Parameters:
sAddr
- the local address, or nullnPortMin
- the minimum port to use, or -1 to use ephemeral sub-portsnPortMax
- the maximum port to usexmlConfig
- optional xml to used in ConfigurationException if this is invalid.
-
LocalAddressProviderBuilder
public LocalAddressProviderBuilder(String sAddr, int nPortMin, int nPortMax)
ConstructsLocalAddressProviderBuilder
deferring address resolution until realized.- Parameters:
sAddr
- the local address, or nullnPortMin
- the minimum port to use, or -1 to use ephemeral sub-portsnPortMax
- the maximum port to use
-
-
Method Detail
-
realize
public AddressProvider realize(ParameterResolver resolver, ClassLoader loader, ParameterList listParameters)
Realizes (creates if necessary) an instance of a object of type T, using the providedParameterResolver
to resolve values any referencedParameter
s.- Specified by:
realize
in interfaceParameterizedBuilder<AddressProvider>
- Parameters:
resolver
- theParameterResolver
for resolving namedParameter
sloader
- theClassLoader
for loading any necessary classes and ifnull
theClassLoader
used to load the builder will be used insteadlistParameters
- an optionalParameterList
(may benull
) to be used for realizing the instance, eg: used as constructor parameters- Returns:
- an instance of T
-
createAddressProvider
public AddressProvider createAddressProvider(ClassLoader loader)
Create a new AddressProvider using the specified class loader.- Specified by:
createAddressProvider
in interfaceAddressProviderFactory
- Parameters:
loader
- the optional ClassLoader with which to configure the new AddressProvider- Returns:
- a new AddressProvider
-
resolveAddress
public InetAddress resolveAddress()
Resolve the host address if provided as a string and cache the value.May return null.
- Returns:
- the resolved host address
-
setAddress
public LocalAddressProviderBuilder setAddress(InetAddress addr)
Set the address to use for any realizedAddressProvider
's- Parameters:
addr
- theInetAddress
- Returns:
- this
LocalAddressProviderBuilder
-
getPortMin
public int getPortMin()
Return the minimum port number.- Returns:
- the minimum port number
-
setPortMin
public LocalAddressProviderBuilder setPortMin(int nPort)
Set the minimum port number.- Parameters:
nPort
- the minimum port number- Returns:
- this
LocalAddressProviderBuilder
-
getPortMinOriginal
public int getPortMinOriginal()
Return the minimum port number provided in the constructor.- Returns:
- the minimum port number
-
setPortMax
public LocalAddressProviderBuilder setPortMax(int nPort)
Set the maximum port number.- Parameters:
nPort
- the maximum port number- Returns:
- this
LocalAddressProviderBuilder
-
-