User: dmaplesden
  Date: 01/12/11 19:24:58

  Modified:    src/main/org/jboss/mq/server MessageCache.java
  Log:
  Undo my object pooling code, it causes a number of bugs when server is under high 
load.
  
  Revision  Changes    Path
  1.9       +4 -28     jbossmq/src/main/org/jboss/mq/server/MessageCache.java
  
  Index: MessageCache.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbossmq/src/main/org/jboss/mq/server/MessageCache.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MessageCache.java 2001/12/09 05:50:31     1.8
  +++ MessageCache.java 2001/12/12 03:24:58     1.9
  @@ -24,14 +24,10 @@
    * later.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Hiram Chirino</a>
  - * @version    $Revision: 1.8 $
  + * @version    $Revision: 1.9 $
    */
   public class MessageCache extends ServiceMBeanSupport implements MessageCacheMBean, 
MBeanRegistration, Runnable
   {
  -   //pool of message ref objects
  -   public static final int MAX_POOL_SIZE = 100*1000;
  -   protected ArrayList pool = new ArrayList(MAX_POOL_SIZE);
  -
      // The cached messages are orded in a LRU linked list
      private LinkedList lruCache = new LinkedList();
   
  @@ -61,25 +57,6 @@
         return this;
      }
   
  -   //this method is only called from within synchronized block, so don't need to 
sync
  -   protected MessageReference getMessageReference(MessageCache messageCache, Long 
referenceId, SpyMessage message) {
  -      MessageReference ref = null;
  -      if(!pool.isEmpty())
  -         ref = (MessageReference)pool.remove(pool.size()-1);
  -      else
  -         ref = new MessageReference();
  -      ref.init(messageCache,referenceId,message);
  -      return ref;
  -   }
  -
  -   //this method is only called from within synchronized block, so don't need to 
sync
  -   protected void releaseMessageReference(MessageReference ref){
  -      if(pool.size() < MAX_POOL_SIZE){
  -         ref.reset();
  -         pool.add(ref);
  -      }
  -   }
  -
      /**
       * Adds a message to the cache
       */
  @@ -88,7 +65,8 @@
         log.trace("add lock aquire");
         synchronized (this)
         {
  -         MessageReference mh = getMessageReference(this, new 
Long(messageCounter++), message);
  +         MessageReference mh = new MessageReference();
  +         mh.init(this, new Long(messageCounter++), message);
            lruCache.addLast(mh);
            totalCacheSize++;
            validateSoftReferenceDepth();
  @@ -108,7 +86,6 @@
         {
            mr.clear();
            lruCache.remove(mr);
  -         releaseMessageReference(mr);
            totalCacheSize--;
            log.trace("remove lock release");
         }
  @@ -443,5 +420,4 @@
      public void setCacheStore(ObjectName cacheStore) {
         cacheStoreObjectName = cacheStore;
      }
  -
  -}
  + }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to