|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.mx.util.JBossNotificationBroadcasterSupport org.jboss.system.ServiceMBeanSupport org.jboss.mq.server.MessageCache
This class implements a Message cache so that larger amounts of messages
can be processed without running out of memory. When memory starts getting tight
it starts moving messages out of memory and into a file so that they can be recovered
later.
The locks should be obtained in the following order:
mr, the relevent message we are working with
lruCache, when maintaining the usage order
Field Summary | |
static long |
DEFAULT_HIGH_MEMORY_MARK
|
static long |
DEFAULT_MAX_MEMORY_MARK
|
static long |
ONE_MEGABYTE
|
Fields inherited from class org.jboss.system.ServiceMBeanSupport |
log, server, SERVICE_CONTROLLER_SIG, serviceName |
Fields inherited from interface org.jboss.mq.server.MessageCacheMBean |
OBJECT_NAME |
Fields inherited from interface org.jboss.system.ServiceMBean |
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED |
Constructor Summary | |
MessageCache()
|
Method Summary | |
MessageReference |
add(SpyMessage message)
Adds a message to the cache |
MessageReference |
add(SpyMessage message,
BasicQueue queue,
int stored)
Adds a message to the cache. |
MessageReference |
add(SpyMessage message,
BasicQueue queue,
int stored,
DurableSubscriptionID id)
Adds a message to the cache. |
MessageReference |
addInternal(SpyMessage message,
BasicQueue queue,
int stored,
DurableSubscriptionID id)
Adds a message to the cache. |
long |
getCacheHits()
Gets the cacheHits |
long |
getCacheMisses()
Gets the cacheMisses |
javax.management.ObjectName |
getCacheStore()
The getCacheStore method |
long |
getCurrentMemoryUsage()
Gets the CurrentMemoryUsage |
int |
getHardRefCacheSize()
Gets the hardRefCacheSize |
long |
getHighMemoryMark()
Gets the highMemoryMark |
MessageCache |
getInstance()
The getInstance method |
boolean |
getMakeSoftReferences()
Gets whether to make soft references |
int |
getMaximumHard()
Gets the maximum number of hard messages |
long |
getMaxMemoryMark()
Gets the maxMemoryMark |
int |
getMinimumHard()
Gets the minimum number of hard messages |
String |
getName()
|
long |
getSoftenAtLeastEveryMillis()
Gets the maximum length between softening checks |
long |
getSoftenedSize()
The getSoftenedSize method |
long |
getSoftenNoMoreOftenThanMillis()
Gets the minimum length between softening checks |
long |
getSoftenWaitMillis()
Gets the length of time to wait before checking whether we should soften |
int |
getSoftRefCacheSize()
Gets the softRefCacheSize |
int |
getTotalCacheSize()
Gets the totalCacheSize |
void |
remove(MessageReference mr)
removes a message from the cache |
void |
removeDelayed(MessageReference mr)
removes a message from the cache without returning it to the pool used in two phase removes for joint cache/persistence |
protected void |
removeInternal(MessageReference mr,
boolean clear,
boolean reset)
removes a message from the cache |
void |
run()
The strategy is that we keep the most recently used messages as Hard references. |
void |
setCacheStore(javax.management.ObjectName cacheStoreName)
|
void |
setHighMemoryMark(long highMemoryMark)
Sets the highMemoryMark |
void |
setMakeSoftReferences(boolean makeSoftReferences)
Sets whether to make soft references |
void |
setMaximumHard(int maximumHard)
Sets the maximum number of hard messages |
void |
setMaxMemoryMark(long maxMemoryMark)
Sets the maxMemoryMark |
void |
setMinimumHard(int minimumHard)
Sets the minimum number of hard messages |
void |
setSoftenAtLeastEveryMillis(long millis)
Sets the minimum length between softening checks |
void |
setSoftenNoMoreOftenThanMillis(long millis)
Sets the minimum length between softening checks |
void |
setSoftenWaitMillis(long millis)
Sets the length of time to wait before checking whether we should soften |
protected void |
startService()
This gets called to start the cache service. |
protected void |
stopService()
This gets called to stop the cache service. |
Methods inherited from class org.jboss.system.ServiceMBeanSupport |
create, createService, destroy, destroyService, getLog, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop |
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport |
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jboss.system.ServiceMBean |
getState, getStateString, jbossInternalLifecycle |
Methods inherited from interface org.jboss.system.Service |
create, destroy, start, stop |
Methods inherited from interface javax.management.MBeanRegistration |
postDeregister, postRegister, preDeregister, preRegister |
Field Detail |
public static final long ONE_MEGABYTE
public static final long DEFAULT_HIGH_MEMORY_MARK
public static final long DEFAULT_MAX_MEMORY_MARK
Constructor Detail |
public MessageCache()
Method Detail |
public MessageCache getInstance()
getInstance
method
getInstance
in interface MessageCacheMBean
MessageCache
valuepublic MessageReference add(SpyMessage message) throws javax.jms.JMSException
javax.jms.JMSException
public MessageReference add(SpyMessage message, BasicQueue queue, int stored) throws javax.jms.JMSException
javax.jms.JMSException
public MessageReference add(SpyMessage message, BasicQueue queue, int stored, DurableSubscriptionID id) throws javax.jms.JMSException
javax.jms.JMSException
public MessageReference addInternal(SpyMessage message, BasicQueue queue, int stored, DurableSubscriptionID id) throws javax.jms.JMSException
javax.jms.JMSException
public void remove(MessageReference mr) throws javax.jms.JMSException
javax.jms.JMSException
public void removeDelayed(MessageReference mr) throws javax.jms.JMSException
javax.jms.JMSException
protected void removeInternal(MessageReference mr, boolean clear, boolean reset) throws javax.jms.JMSException
javax.jms.JMSException
public void run()
Runnable.run()
protected void startService() throws Exception
Exception
protected void stopService()
public int getHardRefCacheSize()
getHardRefCacheSize
in interface MessageCacheMBean
public long getSoftenedSize()
getSoftenedSize
method
getSoftenedSize
in interface MessageCacheMBean
long
valuepublic int getSoftRefCacheSize()
getSoftRefCacheSize
in interface MessageCacheMBean
public int getTotalCacheSize()
getTotalCacheSize
in interface MessageCacheMBean
public long getCacheMisses()
getCacheMisses
in interface MessageCacheMBean
public long getCacheHits()
getCacheHits
in interface MessageCacheMBean
public boolean getMakeSoftReferences()
getMakeSoftReferences
in interface MessageCacheMBean
public void setMakeSoftReferences(boolean makeSoftReferences)
setMakeSoftReferences
in interface MessageCacheMBean
public int getMinimumHard()
getMinimumHard
in interface MessageCacheMBean
public void setMinimumHard(int minimumHard)
setMinimumHard
in interface MessageCacheMBean
minimumHard
- the minimum number of hard messagespublic int getMaximumHard()
getMaximumHard
in interface MessageCacheMBean
public void setMaximumHard(int maximumHard)
setMaximumHard
in interface MessageCacheMBean
maximumHard
- the maximum number of hard messagespublic long getSoftenWaitMillis()
getSoftenWaitMillis
in interface MessageCacheMBean
public void setSoftenWaitMillis(long millis)
setSoftenWaitMillis
in interface MessageCacheMBean
millis
- the time to wait in millispublic long getSoftenNoMoreOftenThanMillis()
getSoftenNoMoreOftenThanMillis
in interface MessageCacheMBean
public void setSoftenNoMoreOftenThanMillis(long millis)
setSoftenNoMoreOftenThanMillis
in interface MessageCacheMBean
public long getSoftenAtLeastEveryMillis()
getSoftenAtLeastEveryMillis
in interface MessageCacheMBean
public void setSoftenAtLeastEveryMillis(long millis)
setSoftenAtLeastEveryMillis
in interface MessageCacheMBean
public long getHighMemoryMark()
getHighMemoryMark
in interface MessageCacheMBean
public void setHighMemoryMark(long highMemoryMark)
setHighMemoryMark
in interface MessageCacheMBean
highMemoryMark
- The highMemoryMark to setpublic long getMaxMemoryMark()
getMaxMemoryMark
in interface MessageCacheMBean
public void setMaxMemoryMark(long maxMemoryMark)
setMaxMemoryMark
in interface MessageCacheMBean
maxMemoryMark
- The maxMemoryMark to setpublic long getCurrentMemoryUsage()
getCurrentMemoryUsage
in interface MessageCacheMBean
public String getName()
getName
in interface org.jboss.system.ServiceMBean
ServiceMBeanSupport.getName()
public void setCacheStore(javax.management.ObjectName cacheStoreName)
setCacheStore
in interface MessageCacheMBean
public javax.management.ObjectName getCacheStore()
getCacheStore
method
getCacheStore
in interface MessageCacheMBean
ObjectName
value
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |