Getting the Current Keep-Alive Parameters
Use the following methods to obtain the current values of the keep-alive settings:
BrokerConnectionDescriptor.getKeepAlivePeriod method.
BrokerConnectionDescriptor.getKeepAliveResponseTime method.
BrokerConnectionDescriptor.getKeepAliveRetryCount method.
The following example checks whether the values of KeepAlivePeriod and MaxResponseTime are set to Integer.MAX_VALUE. (When both KeepAlivePeriod and MaxResponseTime are set to Integer.MAX_VALUE, it disables the keep-alive feature entirely).
BrokerConnectionDescriptor desc;
.
.
.
boolean isDisabled;
isDisabled = (desc.getKeepAlivePeriod() == Integer.MAX_VALUE) &&
(desc.getMaxResponseTime() == Integer.MAX_VALUE) ;
.
.
.