Java Doc for MessageCache.java in  » EJB-Server-JBoss-4.2.1 » messaging » org » jboss » mq » server » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » EJB Server JBoss 4.2.1 » messaging » org.jboss.mq.server 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.jboss.mq.server.MessageCache

All known Subclasses:   org.jboss.mq.kernel.MessageCache,
MessageCache
public class MessageCache extends ServiceMBeanSupport implements MessageCacheMBean,MBeanRegistration,Runnable(Code)
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
author:
   Hiram Chirino
author:
   David Maplesden
author:
   Peter Antman
author:
   Adrian Brock
version:
   $Revision: 57198 $

Inner Class :class LRUCache
Inner Class :static class Node

Field Summary
final public static  longDEFAULT_HIGH_MEMORY_MARK
    
final public static  longDEFAULT_MAX_MEMORY_MARK
    
final public static  longONE_MEGABYTE
    
 longcacheHits
    
 longcacheMisses
    
protected  CacheStorecacheStore
    
 ObjectNamecacheStoreName
    
 booleancheckSoftReferenceDepth
    
 ReferenceQueuereferenceQueue
    
 intsoftRefCacheSize
    
 longsoftenedSize
    
 inttotalCacheSize
    


Method Summary
public  MessageReferenceadd(SpyMessage message, BasicQueue queue, int stored)
     Adds a message to the cache.
public  MessageReferenceadd(SpyMessage message, BasicQueue queue, int stored, DurableSubscriptionID id)
     Adds a message to the cache.
public  MessageReferenceaddInternal(SpyMessage message, BasicQueue queue, int stored, DurableSubscriptionID id)
     Adds a message to the cache.
public  longgetCacheHits()
    
public  longgetCacheMisses()
    
public  ObjectNamegetCacheStore()
    
public  longgetCurrentMemoryUsage()
    
public  intgetHardRefCacheSize()
    
public  longgetHighMemoryMark()
    
public  MessageCachegetInstance()
    
public  booleangetMakeSoftReferences()
    
public  longgetMaxMemoryMark()
    
public  intgetMaximumHard()
    
public  intgetMinimumHard()
    
public  StringgetName()
    
public  intgetSoftRefCacheSize()
    
public  longgetSoftenAtLeastEveryMillis()
    
public  longgetSoftenNoMoreOftenThanMillis()
    
public  longgetSoftenWaitMillis()
    
public  longgetSoftenedSize()
    
public  intgetTotalCacheSize()
    
 SpyMessageloadFromStorage(MessageReference mh)
    
 voidmessageReferenceUsedEvent(MessageReference mh, boolean wasHard)
     This gets called when a MessageReference is de-referenced.
public  voidremove(MessageReference mr)
    
public  voidremoveDelayed(MessageReference mr)
    
 voidremoveFromStorage(MessageReference mh)
    
protected  voidremoveInternal(MessageReference mr, boolean clear, boolean reset)
    
public  voidrun()
     The strategy is that we keep the most recently used messages as Hard references.
 voidsaveToStorage(MessageReference mh, SpyMessage message)
    
public  voidsetCacheStore(ObjectName cacheStoreName)
    
public  voidsetHighMemoryMark(long highMemoryMark)
    
public  voidsetMakeSoftReferences(boolean makeSoftReferences)
    
public  voidsetMaxMemoryMark(long maxMemoryMark)
    
public  voidsetMaximumHard(int maximumHard)
    
public  voidsetMinimumHard(int minimumHard)
    
public  voidsetSoftenAtLeastEveryMillis(long millis)
    
public  voidsetSoftenNoMoreOftenThanMillis(long millis)
    
public  voidsetSoftenWaitMillis(long millis)
    
protected  voidsetupCacheStore()
    
 voidsoften(MessageReference mr)
    
protected  voidstartService()
     This gets called to start the cache service.
protected  voidstopService()
     This gets called to stop the cache service.
 booleanvalidateSoftReferenceDepth()
     This method is in charge of determining if it time to convert some hard references over to soft references.

Field Detail
DEFAULT_HIGH_MEMORY_MARK
final public static long DEFAULT_HIGH_MEMORY_MARK(Code)



DEFAULT_MAX_MEMORY_MARK
final public static long DEFAULT_MAX_MEMORY_MARK(Code)



ONE_MEGABYTE
final public static long ONE_MEGABYTE(Code)



cacheHits
long cacheHits(Code)



cacheMisses
long cacheMisses(Code)



cacheStore
protected CacheStore cacheStore(Code)



cacheStoreName
ObjectName cacheStoreName(Code)



checkSoftReferenceDepth
boolean checkSoftReferenceDepth(Code)



referenceQueue
ReferenceQueue referenceQueue(Code)



softRefCacheSize
int softRefCacheSize(Code)



softenedSize
long softenedSize(Code)



totalCacheSize
int totalCacheSize(Code)





Method Detail
add
public MessageReference add(SpyMessage message, BasicQueue queue, int stored) throws javax.jms.JMSException(Code)
Adds a message to the cache.



add
public MessageReference add(SpyMessage message, BasicQueue queue, int stored, DurableSubscriptionID id) throws javax.jms.JMSException(Code)
Adds a message to the cache.



addInternal
public MessageReference addInternal(SpyMessage message, BasicQueue queue, int stored, DurableSubscriptionID id) throws javax.jms.JMSException(Code)
Adds a message to the cache.



getCacheHits
public long getCacheHits()(Code)
Gets the cacheHits Returns a long



getCacheMisses
public long getCacheMisses()(Code)
Gets the cacheMisses Returns a int



getCacheStore
public ObjectName getCacheStore()(Code)
The getCacheStore method an ObjectName value



getCurrentMemoryUsage
public long getCurrentMemoryUsage()(Code)
Gets the CurrentMemoryUsage Returns a long



getHardRefCacheSize
public int getHardRefCacheSize()(Code)
Gets the hardRefCacheSize Returns a int



getHighMemoryMark
public long getHighMemoryMark()(Code)
Gets the highMemoryMark Returns a long



getInstance
public MessageCache getInstance()(Code)
The getInstance method a MessageCache value



getMakeSoftReferences
public boolean getMakeSoftReferences()(Code)
Gets whether to make soft references true when making soft references



getMaxMemoryMark
public long getMaxMemoryMark()(Code)
Gets the maxMemoryMark Returns a long



getMaximumHard
public int getMaximumHard()(Code)
Gets the maximum number of hard messages the minimum number of hard messages



getMinimumHard
public int getMinimumHard()(Code)
Gets the minimum number of hard messages the minimum number of hard messages



getName
public String getName()(Code)

See Also:   ServiceMBeanSupport.getName



getSoftRefCacheSize
public int getSoftRefCacheSize()(Code)
Gets the softRefCacheSize Returns a int



getSoftenAtLeastEveryMillis
public long getSoftenAtLeastEveryMillis()(Code)
Gets the maximum length between softening checks the time



getSoftenNoMoreOftenThanMillis
public long getSoftenNoMoreOftenThanMillis()(Code)
Gets the minimum length between softening checks the time to wait



getSoftenWaitMillis
public long getSoftenWaitMillis()(Code)
Gets the length of time to wait before checking whether we should soften the time to wait



getSoftenedSize
public long getSoftenedSize()(Code)
The getSoftenedSize method a long value



getTotalCacheSize
public int getTotalCacheSize()(Code)
Gets the totalCacheSize Returns a int



loadFromStorage
SpyMessage loadFromStorage(MessageReference mh) throws JMSException(Code)



messageReferenceUsedEvent
void messageReferenceUsedEvent(MessageReference mh, boolean wasHard) throws JMSException(Code)
This gets called when a MessageReference is de-referenced. We will pop it to the top of the RLU



remove
public void remove(MessageReference mr) throws JMSException(Code)
removes a message from the cache



removeDelayed
public void removeDelayed(MessageReference mr) throws JMSException(Code)
removes a message from the cache without returning it to the pool used in two phase removes for joint cache/persistence



removeFromStorage
void removeFromStorage(MessageReference mh) throws JMSException(Code)



removeInternal
protected void removeInternal(MessageReference mr, boolean clear, boolean reset) throws JMSException(Code)
removes a message from the cache



run
public void run()(Code)
The strategy is that we keep the most recently used messages as Hard references. Then we make the older ones soft references. Making something a soft reference stores it to disk so we need to avoid making soft references if we can avoid it. But once it is made a soft reference does not mean that it is removed from memory. Depending on how agressive the JVM's GC is, it may stay around long enough for it to be used by a client doing a read, saving us read from the file system. If memory gets tight the GC will remove the soft references. What we want to do is make sure there are at least some soft references available so that the GC can reclaim memory.
See Also:   Runnable.run



saveToStorage
void saveToStorage(MessageReference mh, SpyMessage message) throws JMSException(Code)



setCacheStore
public void setCacheStore(ObjectName cacheStoreName)(Code)

See Also:   MessageCacheMBean.setCacheStore(ObjectName)



setHighMemoryMark
public void setHighMemoryMark(long highMemoryMark)(Code)
Sets the highMemoryMark
Parameters:
  highMemoryMark - The highMemoryMark to set



setMakeSoftReferences
public void setMakeSoftReferences(boolean makeSoftReferences)(Code)
Sets whether to make soft references true to make soft references



setMaxMemoryMark
public void setMaxMemoryMark(long maxMemoryMark)(Code)
Sets the maxMemoryMark
Parameters:
  maxMemoryMark - The maxMemoryMark to set



setMaximumHard
public void setMaximumHard(int maximumHard)(Code)
Sets the maximum number of hard messages
Parameters:
  maximumHard - the maximum number of hard messages



setMinimumHard
public void setMinimumHard(int minimumHard)(Code)
Sets the minimum number of hard messages
Parameters:
  minimumHard - the minimum number of hard messages



setSoftenAtLeastEveryMillis
public void setSoftenAtLeastEveryMillis(long millis)(Code)
Sets the minimum length between softening checks
Parameters:
  wait - the time between checks



setSoftenNoMoreOftenThanMillis
public void setSoftenNoMoreOftenThanMillis(long millis)(Code)
Sets the minimum length between softening checks
Parameters:
  wait - the time between checks



setSoftenWaitMillis
public void setSoftenWaitMillis(long millis)(Code)
Sets the length of time to wait before checking whether we should soften
Parameters:
  millis - the time to wait in millis



setupCacheStore
protected void setupCacheStore() throws Exception(Code)



soften
void soften(MessageReference mr) throws JMSException(Code)
removes a message from the cache but does not clear it, used in softening



startService
protected void startService() throws Exception(Code)
This gets called to start the cache service. Synch. by start



stopService
protected void stopService()(Code)
This gets called to stop the cache service.



validateSoftReferenceDepth
boolean validateSoftReferenceDepth() throws JMSException(Code)
This method is in charge of determining if it time to convert some hard references over to soft references.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.