Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 78878 invoked from network); 16 Mar 2007 01:02:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Mar 2007 01:02:48 -0000 Received: (qmail 71331 invoked by uid 500); 16 Mar 2007 01:02:54 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 71297 invoked by uid 500); 16 Mar 2007 01:02:54 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 71281 invoked by uid 99); 16 Mar 2007 01:02:53 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Mar 2007 18:02:53 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [216.13.41.106] (HELO eventiontech.com) (216.13.41.106) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Mar 2007 18:02:41 -0700 Received: from [156.34.233.74] (account glenn.owen HELO [192.168.0.100]) by eventiontech.com (CommuniGate Pro SMTP 4.2.2) with ESMTP-TLS id 1561387 for user@geronimo.apache.org; Thu, 15 Mar 2007 22:02:13 -0300 Subject: Sharing resources in an MDB From: Glenn Owen To: user@geronimo.apache.org Content-Type: text/plain Date: Thu, 15 Mar 2007 22:02:18 -0300 Message-Id: <1174006938.5957.18.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org I'm sure I should have learned this in MDB 101, but I'll ask here anyway. I have an MDB that reads incoming messages, does a bunch of work, and then writes data to another outgoing JMS Queue. As the load increases, Geronimo will create multiple instances of the MDB and I was getting exceptions after about the 10th instance, because I could not get enough outgoing Queue connections. Originally each MDB was looking up the outgoing connection factory and queue and creating a connection,session,producer in onMessage(). But since I was getting the above error, I modified it to get the outgoing connection factory,queue and connection in ejbCreate() and holding onto those is *static* variables, so all instances of the MDB shared the same connection. The onMessage() still gets it's own session and producer. That solved my problem, but I'm not sure it is "right". It is OK to share the factory/queue/connection across multiple instances of an MDB?