com.ibm.mq.jms

Class Cleanup

  1. java.lang.Object
  2. extended bycom.ibm.msg.client.jms.internal.JmsReadablePropertyContextImpl
  3. extended bycom.ibm.msg.client.jms.internal.JmsPropertyContextImpl
  4. extended bycom.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl
  5. extended bycom.ibm.msg.client.jms.admin.JmsJndiConnectionFactoryImpl
  6. extended bycom.ibm.mq.jms.MQConnectionFactory
  7. extended bycom.ibm.mq.jms.Cleanup
All implemented interfaces:
JmsConnectionFactory, JmsPropertyContext, JmsReadablePropertyContext, com.ibm.msg.client.provider.ProviderPropertyContextCallback, java.io.Serializable, java.lang.Runnable, java.util.Map<java.lang.String,java.lang.Object>, javax.jms.ConnectionFactory, javax.naming.Referenceable

  1. public class Cleanup
  2. extends MQConnectionFactory
  3. implements java.lang.Runnable
Cleanup contains utilities for dealing with non-durable subscriptions which are broken, by using the SUBSTATE(BROKER) option. The class is not applicable if you use a real-time connection to a broker.
See Also:
Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class com.ibm.mq.jms.MQConnectionFactory
MQConnectionFactory.ConnectionFactoryProperty
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>

Constructor Summary

Constructor and Description
Cleanup()
Default constructor.
Cleanup(MQConnectionFactory mqcf)
Constructor that imports property values.

Method Summary

Modifier and Type Method and Description
  1. void
cleanup()
Runs Cleanup once.
  1. void
cleanup(boolean runAtRegularIntervals)
Perform cleanup of unwanted messages for non-durable subscribers who are no longer active.
  1. long
getCleanupInterval()
Gets the cleanup interval.
  1. int
getCleanupLevel()
Gets the cleanup level.
  1. javax.jms.ExceptionListener
getExceptionListener()
Gets the ExceptionListener.
  1. boolean
isRunning()
Indicates whether run() is currently active.
  1. static
  2. void
main(java.lang.String[] args)
Invokes the utility directly from a command line.
  1. void
run()
Runs Cleanup.
  1. void
setCleanupInterval(long interval)
Sets the cleanup interval.
  1. void
setCleanupLevel(int level)
Sets the cleanup level.
  1. void
setExceptionListener(javax.jms.ExceptionListener el)
Sets the ExceptionListener.
  1. void
setPrintWriter(java.io.PrintWriter pw)
Sets the Print Writer.
  1. void
stop()
Stops any running cleanup thread.
Methods inherited from class com.ibm.mq.jms.MQConnectionFactory
createConnection, createConnection, getAppName, getAsyncExceptions, getBrokerCCSubQueue, getBrokerControlQueue, getBrokerPubQueue, getBrokerQueueManager, getBrokerSubQueue, getBrokerVersion, getCCDTURL, getCCSID, getChannel, getClientId, getClientID, getClientReconnectOptions, getClientReconnectTimeout, getConnectionNameList, getConnTag, getDescription, getDirectAuth, getFailIfQuiesce, getHdrCompList, getHostName, getLocalAddress, getMapNameStyle, getMaxBufferSize, getMessageRetention, getMessageSelection, getMQConnectionOptions, getMsgBatchSize, getMsgCompList, getMsgCompListAsString, getMulticast, getOptimisticPublication, getOutcomeNotification, getPollingInterval, getPort, getProcessDuration, getProviderVersion, getProxyHostName, getProxyPort, getPubAckInterval, getQueueManager, getReceiveExit, getReceiveExitInit, getReceiveIsolation, getReference, getRescanInterval, getSecurityExit, getSecurityExitInit, getSendCheckCount, getSendExit, getSendExitInit, getShareConvAllowed, getSparseSubscriptions, getSSLCertStores, getSSLCertStoresAsString, getSSLCipherSuite, getSSLFipsRequired, getSSLPeerName, getSSLResetCount, getSSLSocketFactory, getStatusRefreshInterval, getSubscriptionStore, getSyncpointAllGets, getTargetClientMatching, getTemporaryModel, getTempQPrefix, getTempTopicPrefix, getTransportType, getUseConnectionPooling, getVersion, getWildcardFormat, setAppName, setAsyncExceptions, setBrokerCCSubQueue, setBrokerControlQueue, setBrokerPubQueue, setBrokerQueueManager, setBrokerSubQueue, setBrokerVersion, setCCDTURL, setCCSID, setChannel, setClientId, setClientID, setClientReconnectOptions, setClientReconnectTimeout, setConnectionNameList, setConnTag, setDescription, setDirectAuth, setFailIfQuiesce, setHdrCompList, setHostName, setLocalAddress, setMapNameStyle, setMaxBufferSize, setMessageRetention, setMessageSelection, setMQConnectionOptions, setMsgBatchSize, setMsgCompList, setMulticast, setOptimisticPublication, setOutcomeNotification, setPollingInterval, setPort, setProcessDuration, setProviderVersion, setProxyHostName, setProxyPort, setPubAckInterval, setQueueManager, setReceiveExit, setReceiveExitInit, setReceiveIsolation, setRescanInterval, setSecurityExit, setSecurityExitInit, setSendCheckCount, setSendExit, setSendExitInit, setShareConvAllowed, setSparseSubscriptions, setSSLCertStores, setSSLCertStores, setSSLCipherSuite, setSSLFipsRequired, setSSLPeerName, setSSLResetCount, setSSLSocketFactory, setStatusRefreshInterval, setSubscriptionStore, setSyncpointAllGets, setTargetClientMatching, setTemporaryModel, setTempQPrefix, setTempTopicPrefix, setTransportType, setUseConnectionPooling, setWildcardFormat
Methods inherited from class com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl
equals, hashCode
Methods inherited from class com.ibm.msg.client.jms.internal.JmsPropertyContextImpl
clear, containsKey, containsValue, entrySet, get, getObjectProperty, isEmpty, keySet, propertyExists, put, putAll, remove, setBatchProperties, setBooleanProperty, setByteProperty, setBytesProperty, setCharProperty, setDoubleProperty, setFloatProperty, setIntProperty, setLongProperty, setObjectProperty, setProviderPropertyContext, setShortProperty, setStringProperty, size, values
Methods inherited from class com.ibm.msg.client.jms.internal.JmsReadablePropertyContextImpl
getBooleanProperty, getByteProperty, getBytesProperty, getCharProperty, getDoubleProperty, getFloatProperty, getIntProperty, getLongProperty, getPropertyNames, getShortProperty, getStringProperty, toString
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.ibm.msg.client.jms.JmsPropertyContext
setBatchProperties, setBooleanProperty, setByteProperty, setBytesProperty, setCharProperty, setDoubleProperty, setFloatProperty, setIntProperty, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
Methods inherited from interface com.ibm.msg.client.jms.JmsReadablePropertyContext
getBooleanProperty, getByteProperty, getBytesProperty, getCharProperty, getDoubleProperty, getFloatProperty, getIntProperty, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values

Constructor Detail

Cleanup

  1. public Cleanup()
Default constructor.

Cleanup

  1. public Cleanup(MQConnectionFactory mqcf)
  2. throws javax.jms.JMSException
Constructor that imports property values.
Parameters:
mqcf - the topic connection factory that provides the values.
Throws:
javax.jms.JMSException

Method Detail

setCleanupInterval

  1. public void setCleanupInterval( long interval)
  2. throws javax.jms.JMSException
Sets the cleanup interval.
Overrides:
Parameters:
interval - the cleanup interval in milliseconds.
Throws:
javax.jms.JMSException - if interval is either null or invalid.

getCleanupInterval

  1. public long getCleanupInterval( )
Gets the cleanup interval.
Overrides:
Returns:
the cleanup interval.

setCleanupLevel

  1. public void setCleanupLevel(int level)
  2. throws javax.jms.JMSException
Sets the cleanup level.
Overrides:
Parameters:
Throws:
javax.jms.JMSException - if level is not supported or if an illegal state is encountered.

getCleanupLevel

  1. public int getCleanupLevel()
Gets the cleanup level.
Overrides:
Returns:
the cleanup level.
See Also:

main

  1. public static void main(java.lang.String[] args)
  2. throws java.io.UnsupportedEncodingException
Invokes the utility directly from a command line. You can use this if you use the broker-based subscription store. Syntax for bindings attach:

Cleanup [-m ] [-r ] [SAFE | STRONG | FORCE | NONDUR] [-t]
Syntax for client attach:

Cleanup -client [-m ] -host [-port ] [-channel ] [-r ] [SAFE | STRONG | FORCE | NONDUR] [-t]

qmgr
the name of the queue manager.
hostname
the name of the host which is running the queue manager.
port
the port on which the queue manager is listening.
channel
the name of the channel.
interval
the interval between executions of cleanup, in minutes. If not set, cleanup is performed once. This option is not valid with cleanup types of FORCE or NONDUR.
-t
enables tracing.
SAFE | STRONG | FORCE | NONDUR
sets type of clean up. See setCleanupLevel.
Parameters:
args - the input arguments
Throws:
java.io.UnsupportedEncodingException

run

  1. public void run()
Runs Cleanup. It runs in the background at intervals, as determined by setCleanupLevel() and setCleanupInterval(long). If the field set by setCleanupInterval(long) is zero, Cleanup runs once and returns. Otherwise Cleanup runs regularly at the time in milliseconds set by setCleanupInterval(long). CleanupInterval must be zero with WMQConstants.WMQ_CLEANUP_FORCE or WMQConstants.WMQ_CLEANUP_NONDUR set, and CleanupLevel cannot be WMQConstants.WMQ_CLEANUP_NONE. In these cases the method fails with an IllegalStateException. Any exceptions generated are routed to the ExceptionListener.
Specified by:
run in interface java.lang.Runnable

stop

  1. public void stop()
Stops any running cleanup thread. Returns when run() has finished. Does nothing if run() is not running.

setExceptionListener

  1. public void setExceptionListener( javax.jms.ExceptionListener el)
Sets the ExceptionListener. If set, the ExceptionListener receives any exceptions caused while run() is running. Cleanup terminates shortly after issuing the exception to the ExceptionListener. To remove an ExceptionListener, call this method passing in a null value
Parameters:
el - the exception listener.

getExceptionListener

  1. public javax.jms.ExceptionListener getExceptionListener( )
Gets the ExceptionListener.
Returns:
the exception listener.

setPrintWriter

  1. public void setPrintWriter(java.io.PrintWriter pw)
Sets the Print Writer. If set, the PrintWriter will log informational messages to the console when repeated cleanup is running at regular intervals. To remove a PrintWriter, call this method passing in a null value.
Parameters:
pw - the PrintWriter.

isRunning

  1. public boolean isRunning()
Indicates whether run() is currently active.
Returns:
true if active; false otherwise.

cleanup

  1. public void cleanup()
  2. throws javax.jms.JMSException
Runs Cleanup once.
Throws:
java.lang.IllegalStateException - if CleanupLevel is WMQConstants.WMQ_CLEANUP_NONE.
javax.jms.JMSException - if the operation fails

cleanup

  1. public void cleanup(boolean runAtRegularIntervals)
  2. throws javax.jms.JMSException
Perform cleanup of unwanted messages for non-durable subscribers who are no longer active. This method will either perform a single cleanup operation, or a number of repeating cleanup operations at regular intervals. To perform cleanup operations at regular intervals, call this method passing in the value true.
Parameters:
runAtRegularIntervals - - whether repeating cleanup operations should be run at regular intervals.
Throws:
javax.jms.JMSException - if the operation fails