com.ibm.mq.jms
Class Cleanup
- java.lang.Object
- com.ibm.msg.client.jms.internal.JmsReadablePropertyContextImpl
- com.ibm.msg.client.jms.internal.JmsPropertyContextImpl
- com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl
- com.ibm.msg.client.jms.admin.JmsJndiConnectionFactoryImpl
- com.ibm.mq.jms.MQConnectionFactory
- com.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
- public class Cleanup
- extends MQConnectionFactory
- implements java.lang.Runnable
See Also:
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 |
---|---|
|
cleanup()
Runs Cleanup once.
|
|
cleanup(boolean runAtRegularIntervals)
Perform cleanup of unwanted messages for non-durable subscribers who are no
longer active.
|
|
getCleanupInterval()
Gets the cleanup interval.
|
|
getCleanupLevel()
Gets the cleanup level.
|
|
getExceptionListener()
Gets the ExceptionListener.
|
|
isRunning()
Indicates whether
run() is currently active.
|
|
main(java.lang.String[] args)
Invokes the utility directly from a command line.
|
|
run()
Runs Cleanup.
|
|
setCleanupInterval(long interval)
Sets the cleanup interval.
|
|
setCleanupLevel(int level)
Sets the cleanup level.
|
|
setExceptionListener(javax.jms.ExceptionListener el)
Sets the ExceptionListener.
|
|
setPrintWriter(java.io.PrintWriter pw)
Sets the Print Writer.
|
|
stop()
Stops any running cleanup thread.
|
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
- public Cleanup()
Default constructor.
Cleanup
- public Cleanup(MQConnectionFactory mqcf)
- 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
- public void setCleanupInterval( long interval)
- throws javax.jms.JMSException
Sets the cleanup interval.
Overrides:
setCleanupInterval
in class MQConnectionFactory
Parameters:
interval
- the cleanup interval in milliseconds. Throws:
javax.jms.JMSException
- if interval is either null or invalid. getCleanupInterval
- public long getCleanupInterval( )
Gets the cleanup interval.
Overrides:
getCleanupInterval
in class MQConnectionFactory
Returns:
the cleanup interval.
setCleanupLevel
- public void setCleanupLevel(int level)
- throws javax.jms.JMSException
Sets the cleanup level.
Overrides:
setCleanupLevel
in class MQConnectionFactory
Parameters:
level
- the cleanup level. The following values are accepted:
Throws:
javax.jms.JMSException
- if level is not supported or if an illegal state is encountered. getCleanupLevel
- public int getCleanupLevel()
Gets the cleanup level.
Overrides:
getCleanupLevel
in class MQConnectionFactory
main
- public static void main(java.lang.String[] args)
- 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
Syntax for client attach:
Cleanup -client [-m
- 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
- 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
- public void stop()
setExceptionListener
- 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
- public javax.jms.ExceptionListener getExceptionListener( )
Gets the ExceptionListener.
Returns:
the exception listener.
setPrintWriter
- 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
- public boolean isRunning()
Indicates whether
run()
is currently active.
Returns:
true
if active; false
otherwise. cleanup
- public void cleanup()
- 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
- public void cleanup(boolean runAtRegularIntervals)
- 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