public final class ServerLocatorImpl extends Object implements ServerLocatorInternal, DiscoveryListener
ServerLocator
and all
the proper javadoc is located on that interface.Constructor and Description |
---|
ServerLocatorImpl(boolean useHA,
DiscoveryGroupConfiguration groupConfiguration)
Create a ServerLocatorImpl using UDP discovery to lookup cluster
|
ServerLocatorImpl(boolean useHA,
TransportConfiguration... transportConfigs)
Create a ServerLocatorImpl using a static list of live servers
|
ServerLocatorImpl(Topology topology,
boolean useHA,
DiscoveryGroupConfiguration groupConfiguration)
Create a ServerLocatorImpl using UDP discovery to lookup cluster
|
ServerLocatorImpl(Topology topology,
boolean useHA,
TransportConfiguration... transportConfigs)
Create a ServerLocatorImpl using a static list of live servers
|
Modifier and Type | Method and Description |
---|---|
ServerLocatorImpl |
addClusterTopologyListener(ClusterTopologyListener listener) |
ServerLocatorImpl |
addIncomingInterceptor(Interceptor interceptor)
Adds an interceptor which will be executed after packets are received from the server.
|
ServerLocatorImpl |
addOutgoingInterceptor(Interceptor interceptor)
Adds an interceptor which will be executed before packets are sent to the server.
|
boolean |
allInVM()
Verify if all of the transports are using inVM.
|
void |
cleanup() |
static void |
clearThreadPools() |
void |
close()
Closes this factory and release all its resources
|
ClientSessionFactoryInternal |
connect() |
ClientSessionFactoryInternal |
connectNoWarnings()
Like
ServerLocatorInternal.connect() but it does not log warnings if it fails to connect. |
void |
connectorsChanged(List<DiscoveryEntry> newConnectors) |
ClientSessionFactory |
createSessionFactory()
Creates a ClientSessionFactory using whatever load balancing policy is in force
|
ClientSessionFactory |
createSessionFactory(String nodeID)
Creates a
ClientSessionFactory to a specific server. |
ClientSessionFactory |
createSessionFactory(TransportConfiguration transportConfiguration)
Creates a
ClientSessionFactory to a specific server. |
ClientSessionFactory |
createSessionFactory(TransportConfiguration transportConfiguration,
int reconnectAttempts,
boolean failoverOnInitialConnection)
Creates a
ClientSessionFactory to a specific server. |
void |
disableFinalizeCheck()
This method will disable any checks when a GarbageCollection happens
leaving connections open.
|
void |
factoryClosed(ClientSessionFactory factory) |
protected void |
finalize() |
void |
flushTopology() |
int |
getAckBatchSize()
Returns the acknowledgments batch size.
|
AfterConnectInternalListener |
getAfterConnectInternalListener() |
long |
getCallFailoverTimeout()
Returns the blocking calls failover timeout when the client is awaiting failover,
this is over and above the normal call timeout.
|
long |
getCallTimeout()
Returns the blocking calls timeout.
|
long |
getClientFailureCheckPeriod()
Returns the period used to check if a client has failed to receive pings from the server.
|
TransportConfiguration |
getClusterTransportConfiguration() |
int |
getConfirmationWindowSize()
Returns the size for the confirmation window of clients using this factory.
|
String |
getConnectionLoadBalancingPolicyClassName()
Returns the class name of the connection load balancing policy.
|
long |
getConnectionTTL()
Returns the connection time-to-live.
|
int |
getConsumerMaxRate()
Returns the maximum rate of message consumption for consumers created through this factory.
|
int |
getConsumerWindowSize()
Returns the window size for flow control of the consumers created through this factory.
|
DiscoveryGroupConfiguration |
getDiscoveryGroupConfiguration()
The discovery group configuration
|
String |
getGroupID()
Returns the group ID that will be eventually set on each message for the property
Message.HDR_GROUP_ID . |
String |
getIncomingInterceptorList() |
int |
getInitialConnectAttempts() |
TransportConfiguration[] |
getInitialConnectors()
for tests only and not part of the public interface.
|
int |
getInitialMessagePacketSize()
Returns the initial size of messages created through this factory.
|
long |
getMaxRetryInterval()
Returns the maximum retry interval (in the case a retry interval multiplier has been specified).
|
int |
getMinLargeMessageSize()
Returns the large message size threshold.
|
String |
getNodeID() |
String |
getOutgoingInterceptorList() |
int |
getProducerMaxRate()
Returns the maximum rate of message production for producers created through this factory.
|
int |
getProducerWindowSize()
Returns the window size for flow control of the producers created through this factory.
|
ClientProtocolManagerFactory |
getProtocolManagerFactory() |
int |
getReconnectAttempts()
Returns the maximum number of attempts to retry connection in case of failure.
|
long |
getRetryInterval()
Returns the time to retry connections created by this factory after failure.
|
double |
getRetryIntervalMultiplier()
Returns the multiplier to apply to successive retry intervals.
|
int |
getScheduledThreadPoolMaxSize()
Returns the maximum size of the scheduled thread pool.
|
TransportConfiguration[] |
getStaticTransportConfigurations()
Returns an array of TransportConfigurations representing the static list of live servers used
when creating this object
|
int |
getThreadPoolMaxSize()
Returns the maximum size of the thread pool.
|
Topology |
getTopology()
Exposes the Topology used by this ServerLocator.
|
boolean |
getUseTopologyForLoadBalancing() |
void |
initialize()
This will only instantiate internal objects such as the topology
|
boolean |
isAutoGroup()
Returns whether producers created through this factory will automatically
assign a group ID to the messages they sent.
|
boolean |
isBlockOnAcknowledge()
Returns whether consumers created through this factory will block while
sending message acknowledgments or do it asynchronously.
|
boolean |
isBlockOnDurableSend()
Returns whether producers created through this factory will block while sending durable messages or do it asynchronously.
|
boolean |
isBlockOnNonDurableSend()
Returns whether producers created through this factory will block while sending non-durable messages or do it asynchronously.
|
boolean |
isCacheLargeMessagesClient()
When
true , consumers created through this factory will create temporary files to
cache large messages. |
boolean |
isClosed()
Returns true if close was already called
|
boolean |
isClusterConnection() |
boolean |
isCompressLargeMessage()
Whether to compress large messages.
|
boolean |
isConnectable() |
boolean |
isFailoverOnInitialConnection()
Returns true if the client will automatically attempt to connect to the backup server if the initial
connection to the live server fails
|
boolean |
isHA()
Whether this server receives topology notifications from the cluster as servers join or leave
the cluster.
|
boolean |
isPreAcknowledge()
Returns whether messages will pre-acknowledged on the server before they are sent to the consumers or not.
|
boolean |
isReceivedTopology() |
boolean |
isUseGlobalPools()
Returns whether this factory will use global thread pools (shared among all the factories in the same JVM)
or its own pools.
|
static ServerLocator |
newLocator(String uri) |
static ServerLocator |
newLocator(URI uri) |
ClientProtocolManager |
newProtocolManager() |
void |
notifyNodeDown(long eventTime,
String nodeID)
This is directly called when the connection to the node is gone,
or when the node sends a disconnection.
|
void |
notifyNodeUp(long uniqueEventID,
String nodeID,
String backupGroupName,
String scaleDownGroupName,
Pair<TransportConfiguration,TransportConfiguration> connectorPair,
boolean last) |
void |
removeClusterTopologyListener(ClusterTopologyListener listener) |
boolean |
removeIncomingInterceptor(Interceptor interceptor)
Removes an incoming interceptor.
|
boolean |
removeOutgoingInterceptor(Interceptor interceptor)
Removes an outgoing interceptor.
|
void |
resetToInitialConnectors() |
ServerLocatorImpl |
setAckBatchSize(int ackBatchSize)
Sets the acknowledgments batch size.
|
ServerLocatorImpl |
setAfterConnectionInternalListener(AfterConnectInternalListener listener) |
ServerLocatorImpl |
setAutoGroup(boolean autoGroup)
Sets whether producers created through this factory will automatically
assign a group ID to the messages they sent.
|
ServerLocatorImpl |
setBlockOnAcknowledge(boolean blockOnAcknowledge)
Sets whether consumers created through this factory will block while
sending message acknowledgments or do it asynchronously.
|
ServerLocatorImpl |
setBlockOnDurableSend(boolean blockOnDurableSend)
Sets whether producers created through this factory will block while sending durable messages or do it asynchronously.
|
ServerLocatorImpl |
setBlockOnNonDurableSend(boolean blockOnNonDurableSend)
Sets whether producers created through this factory will block while sending non-durable messages or do it asynchronously.
|
ServerLocatorImpl |
setCacheLargeMessagesClient(boolean cached)
Sets whether large messages received by consumers created through this factory will be cached in temporary files or not.
|
ServerLocatorImpl |
setCallFailoverTimeout(long callFailoverTimeout)
Sets the blocking call failover timeout.
|
ServerLocatorImpl |
setCallTimeout(long callTimeout)
Sets the blocking call timeout.
|
ServerLocatorImpl |
setClientFailureCheckPeriod(long clientFailureCheckPeriod)
Sets the period (in milliseconds) used to check if a client has failed to receive pings from
the server.
|
ServerLocatorImpl |
setClusterConnection(boolean clusterConnection) |
ServerLocatorImpl |
setClusterTransportConfiguration(TransportConfiguration tc) |
ServerLocatorImpl |
setCompressLargeMessage(boolean avoid)
Sets whether to compress or not large messages.
|
ServerLocatorImpl |
setConfirmationWindowSize(int confirmationWindowSize)
Sets the size for the confirmation window buffer of clients using this factory.
|
ServerLocatorImpl |
setConnectionLoadBalancingPolicyClassName(String loadBalancingPolicyClassName)
Sets the class name of the connection load balancing policy.
|
ServerLocatorImpl |
setConnectionTTL(long connectionTTL)
Sets this factory's connections time-to-live.
|
ServerLocatorImpl |
setConsumerMaxRate(int consumerMaxRate)
Sets the maximum rate of message consumption for consumers created through this factory.
|
ServerLocatorImpl |
setConsumerWindowSize(int consumerWindowSize)
Sets the window size for flow control of the consumers created through this factory.
|
ServerLocatorImpl |
setFailoverOnInitialConnection(boolean failover)
Sets the value for FailoverOnInitialReconnection
|
ServerLocatorImpl |
setGroupID(String groupID)
Sets the group ID that will be set on each message sent through this factory.
|
ServerLocatorImpl |
setIdentity(String identity)
Used to better identify Cluster Connection Locators on logs.
|
ServerLocator |
setIncomingInterceptorList(String interceptorList) |
ServerLocatorImpl |
setInitialConnectAttempts(int initialConnectAttempts)
Sets the maximum number of attempts to establish an initial connection.
|
ServerLocatorImpl |
setInitialMessagePacketSize(int size)
Sets the initial size of messages created through this factory.
|
ServerLocatorImpl |
setMaxRetryInterval(long retryInterval)
Sets the maximum retry interval.
|
ServerLocatorImpl |
setMinLargeMessageSize(int minLargeMessageSize)
Sets the large message size threshold.
|
ServerLocatorImpl |
setNodeID(String nodeID) |
ServerLocator |
setOutgoingInterceptorList(String interceptorList) |
ServerLocatorImpl |
setPreAcknowledge(boolean preAcknowledge)
Sets to
true to pre-acknowledge consumed messages on the
server before they are sent to consumers, else set to false
to let clients acknowledge the message they consume. |
ServerLocatorImpl |
setProducerMaxRate(int producerMaxRate)
Sets the maximum rate of message production for producers created through this factory.
|
ServerLocatorImpl |
setProducerWindowSize(int producerWindowSize)
Returns the window size for flow control of the producers created through this factory.
|
ServerLocator |
setProtocolManagerFactory(ClientProtocolManagerFactory protocolManagerFactory) |
ServerLocatorImpl |
setReconnectAttempts(int reconnectAttempts)
Sets the maximum number of attempts to retry connection in case of failure.
|
ServerLocatorImpl |
setRetryInterval(long retryInterval)
Sets the time to retry connections created by this factory after failure.
|
ServerLocatorImpl |
setRetryIntervalMultiplier(double retryIntervalMultiplier)
Sets the multiplier to apply to successive retry intervals.
|
ServerLocatorImpl |
setScheduledThreadPoolMaxSize(int scheduledThreadPoolMaxSize)
Sets the maximum size of the scheduled thread pool.
|
ServerLocatorImpl |
setThreadPoolMaxSize(int threadPoolMaxSize)
Sets the maximum size of the thread pool.
|
boolean |
setThreadPools(Executor threadPool,
ScheduledExecutorService scheduledThreadPool) |
ServerLocatorImpl |
setUseGlobalPools(boolean useGlobalPools)
Sets whether this factory will use global thread pools (shared among all the factories in the same JVM)
or its own pools.
|
ServerLocator |
setUseTopologyForLoadBalancing(boolean useTopologyForLoadBalancing) |
void |
start(Executor executor) |
String |
toString() |
public ServerLocatorImpl(boolean useHA, DiscoveryGroupConfiguration groupConfiguration)
public ServerLocatorImpl(boolean useHA, TransportConfiguration... transportConfigs)
transportConfigs
- public ServerLocatorImpl(Topology topology, boolean useHA, DiscoveryGroupConfiguration groupConfiguration)
public ServerLocatorImpl(Topology topology, boolean useHA, TransportConfiguration... transportConfigs)
transportConfigs
- public static void clearThreadPools()
public boolean setThreadPools(Executor threadPool, ScheduledExecutorService scheduledThreadPool)
setThreadPools
in interface ServerLocator
public void initialize() throws ActiveMQException
ServerLocator
initialize
in interface ServerLocator
ActiveMQException
public static ServerLocator newLocator(String uri)
public static ServerLocator newLocator(URI uri)
public void resetToInitialConnectors()
resetToInitialConnectors
in interface ServerLocatorInternal
public boolean allInVM()
ServerLocator
allInVM
in interface ServerLocator
true
if the locator has all inVM transports.public void start(Executor executor) throws Exception
start
in interface ServerLocatorInternal
Exception
public ClientProtocolManager newProtocolManager()
newProtocolManager
in interface ServerLocatorInternal
public ClientProtocolManagerFactory getProtocolManagerFactory()
getProtocolManagerFactory
in interface ServerLocator
public ServerLocator setProtocolManagerFactory(ClientProtocolManagerFactory protocolManagerFactory)
setProtocolManagerFactory
in interface ServerLocator
public void disableFinalizeCheck()
ServerLocator
Warning: You may leave resources unattended if you call this method and don't take care of cleaning the resources yourself.
disableFinalizeCheck
in interface ServerLocator
public ClientSessionFactoryInternal connect() throws ActiveMQException
connect
in interface ServerLocatorInternal
ActiveMQException
public ClientSessionFactoryInternal connectNoWarnings() throws ActiveMQException
ServerLocatorInternal
ServerLocatorInternal.connect()
but it does not log warnings if it fails to connect.connectNoWarnings
in interface ServerLocatorInternal
ActiveMQException
public ServerLocatorImpl setAfterConnectionInternalListener(AfterConnectInternalListener listener)
setAfterConnectionInternalListener
in interface ServerLocatorInternal
public AfterConnectInternalListener getAfterConnectInternalListener()
getAfterConnectInternalListener
in interface ServerLocatorInternal
public ClientSessionFactory createSessionFactory(String nodeID) throws Exception
ServerLocator
ClientSessionFactory
to a specific server. The server must already be known
about by this ServerLocator. This method allows the user to make a connection to a specific
server bypassing any load balancing policy in forcecreateSessionFactory
in interface ServerLocator
null
if the node is not present on the
topologyException
- if a failure happened in creating the ClientSessionFactory or the
ServerLocator does not know about the passed in transportConfigurationpublic ClientSessionFactory createSessionFactory(TransportConfiguration transportConfiguration) throws Exception
ServerLocator
ClientSessionFactory
to a specific server. The server must already be known
about by this ServerLocator. This method allows the user to make a connection to a specific
server bypassing any load balancing policy in forcecreateSessionFactory
in interface ServerLocator
ClientSessionFactory
instanceException
- if a failure happened in creating the ClientSessionFactory or the
ServerLocator does not know about the passed in transportConfigurationpublic ClientSessionFactory createSessionFactory(TransportConfiguration transportConfiguration, int reconnectAttempts, boolean failoverOnInitialConnection) throws Exception
ServerLocator
ClientSessionFactory
to a specific server. The server must already be known
about by this ServerLocator. This method allows the user to make a connection to a specific
server bypassing any load balancing policy in forcecreateSessionFactory
in interface ServerLocator
reconnectAttempts
- number of attempts of reconnection to performClientSessionFactory
instanceException
- if a failure happened in creating the ClientSessionFactory or the
ServerLocator does not know about the passed in transportConfigurationpublic ClientSessionFactory createSessionFactory() throws ActiveMQException
ServerLocator
createSessionFactory
in interface ServerLocator
ActiveMQException
public void flushTopology()
public boolean isHA()
ServerLocator
isHA
in interface ServerLocator
true
if the locator receives topology updates from the clusterpublic ServerLocator setIncomingInterceptorList(String interceptorList)
setIncomingInterceptorList
in interface ServerLocator
interceptorList
- a comma separated string of incoming interceptor class names to be used. Each interceptor needs a default Constructor to be used with this method.public String getIncomingInterceptorList()
getIncomingInterceptorList
in interface ServerLocator
public ServerLocator setOutgoingInterceptorList(String interceptorList)
setOutgoingInterceptorList
in interface ServerLocator
interceptorList
- a comma separated string of incoming interceptor class names to be used. Each interceptor needs a default Constructor to be used with this method.public String getOutgoingInterceptorList()
getOutgoingInterceptorList
in interface ServerLocator
public boolean isCacheLargeMessagesClient()
ServerLocator
true
, consumers created through this factory will create temporary files to
cache large messages.
There is 1 temporary file created for each large message.
Default value is ActiveMQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT
.
isCacheLargeMessagesClient
in interface ServerLocator
true
if consumers created through this factory will cache large messages
in temporary files, false
elsepublic ServerLocatorImpl setCacheLargeMessagesClient(boolean cached)
ServerLocator
setCacheLargeMessagesClient
in interface ServerLocator
cached
- true
to cache large messages in temporary files, false
elsepublic long getClientFailureCheckPeriod()
ServerLocator
Period is in milliseconds, default value is
ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD
.
getClientFailureCheckPeriod
in interface ServerLocator
public ServerLocatorImpl setClientFailureCheckPeriod(long clientFailureCheckPeriod)
ServerLocator
Value must be -1 (to disable) or greater than 0.
setClientFailureCheckPeriod
in interface ServerLocator
clientFailureCheckPeriod
- the period to check failurepublic long getConnectionTTL()
ServerLocator
This TTL determines how long the server will keep a connection alive in the absence of any
data arriving from the client. Value is in milliseconds, default value is
ActiveMQClient.DEFAULT_CONNECTION_TTL
.
getConnectionTTL
in interface ServerLocator
public ServerLocatorImpl setConnectionTTL(long connectionTTL)
ServerLocator
Value must be -1 (to disable) or greater or equals to 0.
setConnectionTTL
in interface ServerLocator
connectionTTL
- period in millisecondspublic long getCallTimeout()
ServerLocator
If client's blocking calls to the server take more than this timeout, the call will throw a
ActiveMQException
with the code ActiveMQExceptionType.CONNECTION_TIMEDOUT
. Value
is in milliseconds, default value is ActiveMQClient.DEFAULT_CALL_TIMEOUT
.
getCallTimeout
in interface ServerLocator
public ServerLocatorImpl setCallTimeout(long callTimeout)
ServerLocator
Value must be greater or equals to 0
setCallTimeout
in interface ServerLocator
callTimeout
- blocking call timeout in millisecondspublic long getCallFailoverTimeout()
ServerLocator
If client is in the process of failing over when a blocking call is called then the client will wait this long before actually trying the send.
getCallFailoverTimeout
in interface ServerLocator
public ServerLocatorImpl setCallFailoverTimeout(long callFailoverTimeout)
ServerLocator
When the client is awaiting failover, this is over and above the normal call timeout.
Value must be greater or equals to -1, -1 means forever
setCallFailoverTimeout
in interface ServerLocator
callFailoverTimeout
- blocking call timeout in millisecondspublic int getMinLargeMessageSize()
ServerLocator
Messages whose size is if greater than this value will be handled as large messages.
Value is in bytes, default value is ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE
.
getMinLargeMessageSize
in interface ServerLocator
public ServerLocatorImpl setMinLargeMessageSize(int minLargeMessageSize)
ServerLocator
Value must be greater than 0.
setMinLargeMessageSize
in interface ServerLocator
minLargeMessageSize
- large message size threshold in bytespublic int getConsumerWindowSize()
ServerLocator
Value is in bytes, default value is ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE
.
getConsumerWindowSize
in interface ServerLocator
public ServerLocatorImpl setConsumerWindowSize(int consumerWindowSize)
ServerLocator
Value must be -1 (to disable flow control), 0 (to not buffer any messages) or greater than 0 (to set the maximum size of the buffer)
setConsumerWindowSize
in interface ServerLocator
consumerWindowSize
- window size (in bytes) used for consumer flow controlpublic int getConsumerMaxRate()
ServerLocator
This value controls the rate at which a consumer can consume messages. A consumer will never consume messages at a rate faster than the rate specified.
Value is -1 (to disable) or a positive integer corresponding to the maximum desired message consumption rate specified in units of messages per second.
Default value is ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE
.
getConsumerMaxRate
in interface ServerLocator
public ServerLocatorImpl setConsumerMaxRate(int consumerMaxRate)
ServerLocator
Value must -1 (to disable) or a positive integer corresponding to the maximum desired message consumption rate specified in units of messages per second.
setConsumerMaxRate
in interface ServerLocator
consumerMaxRate
- maximum rate of message consumption (in messages per seconds)public int getConfirmationWindowSize()
ServerLocator
Value is in bytes or -1 (to disable the window). Default value is
ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE
.
getConfirmationWindowSize
in interface ServerLocator
public ServerLocatorImpl setConfirmationWindowSize(int confirmationWindowSize)
ServerLocator
Value must be -1 (to disable the window) or greater than 0.
setConfirmationWindowSize
in interface ServerLocator
confirmationWindowSize
- size of the confirmation window (in bytes)public int getProducerWindowSize()
ServerLocator
Value must be -1 (to disable flow control) or greater than 0 to determine the maximum amount of bytes at any give time (to prevent overloading the connection).
Default value is ActiveMQClient.DEFAULT_PRODUCER_WINDOW_SIZE
.
getProducerWindowSize
in interface ServerLocator
public ServerLocatorImpl setProducerWindowSize(int producerWindowSize)
ServerLocator
Value must be -1 (to disable flow control) or greater than 0.
setProducerWindowSize
in interface ServerLocator
producerWindowSize
- window size (in bytest) for flow control of the producers created through this factory.public int getProducerMaxRate()
ServerLocator
This value controls the rate at which a producer can produce messages. A producer will never produce messages at a rate faster than the rate specified.
Value is -1 (to disable) or a positive integer corresponding to the maximum desired message production rate specified in units of messages per second.
Default value is ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE
.
getProducerMaxRate
in interface ServerLocator
public ServerLocatorImpl setProducerMaxRate(int producerMaxRate)
ServerLocator
Value must -1 (to disable) or a positive integer corresponding to the maximum desired message production rate specified in units of messages per second.
setProducerMaxRate
in interface ServerLocator
producerMaxRate
- maximum rate of message production (in messages per seconds)public boolean isBlockOnAcknowledge()
ServerLocator
Default value is ActiveMQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE
.
isBlockOnAcknowledge
in interface ServerLocator
public ServerLocatorImpl setBlockOnAcknowledge(boolean blockOnAcknowledge)
ServerLocator
setBlockOnAcknowledge
in interface ServerLocator
blockOnAcknowledge
- true
to block when sending message
acknowledgments or false
to send them
asynchronouslypublic boolean isBlockOnDurableSend()
ServerLocator
Default value is ActiveMQClient.DEFAULT_BLOCK_ON_DURABLE_SEND
.
isBlockOnDurableSend
in interface ServerLocator
public ServerLocatorImpl setBlockOnDurableSend(boolean blockOnDurableSend)
ServerLocator
setBlockOnDurableSend
in interface ServerLocator
blockOnDurableSend
- true
to block when sending durable messages or false
to send them asynchronouslypublic boolean isBlockOnNonDurableSend()
ServerLocator
Default value is ActiveMQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND
.
isBlockOnNonDurableSend
in interface ServerLocator
public ServerLocatorImpl setBlockOnNonDurableSend(boolean blockOnNonDurableSend)
ServerLocator
setBlockOnNonDurableSend
in interface ServerLocator
blockOnNonDurableSend
- true
to block when sending non-durable messages or false
to send them asynchronouslypublic boolean isAutoGroup()
ServerLocator
if true
, a random unique group ID is created and set on each message for the property
Message.HDR_GROUP_ID
.
Default value is ActiveMQClient.DEFAULT_AUTO_GROUP
.
isAutoGroup
in interface ServerLocator
public ServerLocatorImpl setAutoGroup(boolean autoGroup)
ServerLocator
setAutoGroup
in interface ServerLocator
autoGroup
- true
to automatically assign a group ID to each messages sent through this factory, false
elsepublic boolean isPreAcknowledge()
ServerLocator
Default value is ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE
isPreAcknowledge
in interface ServerLocator
public ServerLocatorImpl setPreAcknowledge(boolean preAcknowledge)
ServerLocator
true
to pre-acknowledge consumed messages on the
server before they are sent to consumers, else set to false
to let clients acknowledge the message they consume.setPreAcknowledge
in interface ServerLocator
preAcknowledge
- true
to enable pre-acknowledgment,
false
elsepublic int getAckBatchSize()
ServerLocator
Default value is ActiveMQClient.DEFAULT_ACK_BATCH_SIZE
.
getAckBatchSize
in interface ServerLocator
public ServerLocatorImpl setAckBatchSize(int ackBatchSize)
ServerLocator
Value must be equal or greater than 0.
setAckBatchSize
in interface ServerLocator
ackBatchSize
- acknowledgments batch sizepublic boolean isUseGlobalPools()
ServerLocator
Default value is ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS
.
isUseGlobalPools
in interface ServerLocator
true
if this factory uses global thread pools, false
elsepublic ServerLocatorImpl setUseGlobalPools(boolean useGlobalPools)
ServerLocator
setUseGlobalPools
in interface ServerLocator
useGlobalPools
- true
to let this factory uses global thread pools, false
elsepublic int getScheduledThreadPoolMaxSize()
ServerLocator
Default value is ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE
.
getScheduledThreadPoolMaxSize
in interface ServerLocator
public ServerLocatorImpl setScheduledThreadPoolMaxSize(int scheduledThreadPoolMaxSize)
ServerLocator
This setting is relevant only if this factory does not use global pools. Value must be greater than 0.
setScheduledThreadPoolMaxSize
in interface ServerLocator
scheduledThreadPoolMaxSize
- maximum size of the scheduled thread pool.public int getThreadPoolMaxSize()
ServerLocator
Default value is ActiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE
.
getThreadPoolMaxSize
in interface ServerLocator
public ServerLocatorImpl setThreadPoolMaxSize(int threadPoolMaxSize)
ServerLocator
This setting is relevant only if this factory does not use global pools. Value must be -1 (for unlimited thread pool) or greater than 0.
setThreadPoolMaxSize
in interface ServerLocator
threadPoolMaxSize
- maximum size of the thread pool.public long getRetryInterval()
ServerLocator
Value is in milliseconds, default is ActiveMQClient.DEFAULT_RETRY_INTERVAL
.
getRetryInterval
in interface ServerLocator
public ServerLocatorImpl setRetryInterval(long retryInterval)
ServerLocator
Value must be greater than 0.
setRetryInterval
in interface ServerLocator
retryInterval
- time (in milliseconds) to retry connections created by this factory after failurepublic long getMaxRetryInterval()
ServerLocator
Value is in milliseconds, default value is ActiveMQClient.DEFAULT_MAX_RETRY_INTERVAL
.
getMaxRetryInterval
in interface ServerLocator
public ServerLocatorImpl setMaxRetryInterval(long retryInterval)
ServerLocator
Value must be greater than 0.
setMaxRetryInterval
in interface ServerLocator
retryInterval
- maximum retry interval to apply in the case a retry interval multiplier
has been specifiedpublic double getRetryIntervalMultiplier()
ServerLocator
Default value is ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER
.
getRetryIntervalMultiplier
in interface ServerLocator
public ServerLocatorImpl setRetryIntervalMultiplier(double retryIntervalMultiplier)
ServerLocator
Value must be positive.
setRetryIntervalMultiplier
in interface ServerLocator
retryIntervalMultiplier
- multiplier to apply to successive retry intervalspublic int getReconnectAttempts()
ServerLocator
Default value is ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS
.
getReconnectAttempts
in interface ServerLocator
public ServerLocatorImpl setReconnectAttempts(int reconnectAttempts)
ServerLocator
Value must be -1 (to retry infinitely), 0 (to never retry connection) or greater than 0.
setReconnectAttempts
in interface ServerLocator
reconnectAttempts
- maximum number of attempts to retry connection in case of failurepublic ServerLocatorImpl setInitialConnectAttempts(int initialConnectAttempts)
ServerLocator
Value must be -1 (to retry infinitely), 0 (to never retry connection) or greater than 0.
setInitialConnectAttempts
in interface ServerLocator
initialConnectAttempts
- maximum number of attempts for the initial connectionpublic int getInitialConnectAttempts()
getInitialConnectAttempts
in interface ServerLocator
public boolean isFailoverOnInitialConnection()
ServerLocator
Default value is ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION
.
isFailoverOnInitialConnection
in interface ServerLocator
public ServerLocatorImpl setFailoverOnInitialConnection(boolean failover)
ServerLocator
setFailoverOnInitialConnection
in interface ServerLocator
public String getConnectionLoadBalancingPolicyClassName()
ServerLocator
Default value is "org.apache.activemq.artemis.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy".
getConnectionLoadBalancingPolicyClassName
in interface ServerLocator
public ServerLocatorImpl setConnectionLoadBalancingPolicyClassName(String loadBalancingPolicyClassName)
ServerLocator
Value must be the name of a class implementing ConnectionLoadBalancingPolicy
.
setConnectionLoadBalancingPolicyClassName
in interface ServerLocator
loadBalancingPolicyClassName
- class name of the connection load balancing policypublic TransportConfiguration[] getStaticTransportConfigurations()
ServerLocator
getStaticTransportConfigurations
in interface ServerLocator
TransportConfiguration
spublic DiscoveryGroupConfiguration getDiscoveryGroupConfiguration()
ServerLocator
getDiscoveryGroupConfiguration
in interface ServerLocator
public ServerLocatorImpl addIncomingInterceptor(Interceptor interceptor)
ServerLocator
addIncomingInterceptor
in interface ServerLocator
interceptor
- an Interceptorpublic ServerLocatorImpl addOutgoingInterceptor(Interceptor interceptor)
ServerLocator
addOutgoingInterceptor
in interface ServerLocator
interceptor
- an Interceptorpublic boolean removeIncomingInterceptor(Interceptor interceptor)
ServerLocator
removeIncomingInterceptor
in interface ServerLocator
interceptor
- interceptor to removetrue
if the incoming interceptor is removed from this factory, false
elsepublic boolean removeOutgoingInterceptor(Interceptor interceptor)
ServerLocator
removeOutgoingInterceptor
in interface ServerLocator
interceptor
- interceptor to removetrue
if the outgoing interceptor is removed from this factory, false
elsepublic int getInitialMessagePacketSize()
ServerLocator
Value is in bytes, default value is ActiveMQClient.DEFAULT_INITIAL_MESSAGE_PACKET_SIZE
.
getInitialMessagePacketSize
in interface ServerLocator
public ServerLocatorImpl setInitialMessagePacketSize(int size)
ServerLocator
Value must be greater than 0.
setInitialMessagePacketSize
in interface ServerLocator
size
- initial size of messages created through this factory.public ServerLocatorImpl setGroupID(String groupID)
ServerLocator
setGroupID
in interface ServerLocator
groupID
- the group ID to usepublic String getGroupID()
ServerLocator
Message.HDR_GROUP_ID
.
Default value is is null
and no group ID will be set on the messages.
getGroupID
in interface ServerLocator
public boolean isCompressLargeMessage()
ServerLocator
isCompressLargeMessage
in interface ServerLocator
public ServerLocatorImpl setCompressLargeMessage(boolean avoid)
ServerLocator
setCompressLargeMessage
in interface ServerLocator
public ServerLocatorImpl setIdentity(String identity)
ServerLocatorInternal
setIdentity
in interface ServerLocatorInternal
public ServerLocatorImpl setNodeID(String nodeID)
setNodeID
in interface ServerLocatorInternal
public String getNodeID()
getNodeID
in interface ServerLocatorInternal
public ServerLocatorImpl setClusterConnection(boolean clusterConnection)
setClusterConnection
in interface ServerLocatorInternal
public boolean isClusterConnection()
isClusterConnection
in interface ServerLocatorInternal
public TransportConfiguration getClusterTransportConfiguration()
getClusterTransportConfiguration
in interface ServerLocatorInternal
public ServerLocatorImpl setClusterTransportConfiguration(TransportConfiguration tc)
setClusterTransportConfiguration
in interface ServerLocatorInternal
protected void finalize() throws Throwable
public void cleanup()
cleanup
in interface ServerLocatorInternal
public void close()
ServerLocator
close
in interface AutoCloseable
close
in interface ServerLocator
public void notifyNodeDown(long eventTime, String nodeID)
notifyNodeDown
in interface ServerLocatorInternal
eventTime
- 0 means get the previous ID +1public void notifyNodeUp(long uniqueEventID, String nodeID, String backupGroupName, String scaleDownGroupName, Pair<TransportConfiguration,TransportConfiguration> connectorPair, boolean last)
notifyNodeUp
in interface ServerLocatorInternal
public void connectorsChanged(List<DiscoveryEntry> newConnectors)
connectorsChanged
in interface DiscoveryListener
public void factoryClosed(ClientSessionFactory factory)
factoryClosed
in interface ServerLocatorInternal
public ServerLocator setUseTopologyForLoadBalancing(boolean useTopologyForLoadBalancing)
setUseTopologyForLoadBalancing
in interface ServerLocator
public boolean getUseTopologyForLoadBalancing()
getUseTopologyForLoadBalancing
in interface ServerLocator
public Topology getTopology()
ServerLocator
getTopology
in interface ServerLocator
getTopology
in interface ServerLocatorInternal
public boolean isConnectable()
isConnectable
in interface ServerLocatorInternal
public ServerLocatorImpl addClusterTopologyListener(ClusterTopologyListener listener)
addClusterTopologyListener
in interface ServerLocator
public void removeClusterTopologyListener(ClusterTopologyListener listener)
removeClusterTopologyListener
in interface ServerLocator
public TransportConfiguration[] getInitialConnectors()
public boolean isClosed()
ServerLocator
isClosed
in interface ServerLocator
true
if closed, false
otherwise.public boolean isReceivedTopology()
Copyright © 2019 JBoss by Red Hat. All rights reserved.