Return-Path: Delivered-To: apmail-jakarta-struts-user-archive@apache.org Received: (qmail 16463 invoked from network); 1 Apr 2002 17:32:56 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 1 Apr 2002 17:32:56 -0000 Received: (qmail 3376 invoked by uid 97); 1 Apr 2002 17:32:46 -0000 Delivered-To: qmlist-jakarta-archive-struts-user@jakarta.apache.org Received: (qmail 3338 invoked by uid 97); 1 Apr 2002 17:32:45 -0000 Mailing-List: contact struts-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list struts-user@jakarta.apache.org Received: (qmail 3327 invoked from network); 1 Apr 2002 17:32:45 -0000 X-Authentication-Warning: coltrane.crossley.org: jim set sender to jcrossley@ifleet.com using -f Sender: jim@coltrane.crossley.org To: "Struts Users Mailing List" Subject: Re: Hi Folks, 2 questions about Actions and their instance References: From: Jim Crossley Date: 01 Apr 2002 12:37:35 -0500 In-Reply-To: Message-ID: Lines: 19 User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N theron.kousek@webmd.net writes: > > I don't know, but it doesn't matter. You should always assume that > > any specific instance of an Action class could potentially serve multiple > > threads at once. Or else what's the point of putting your app on the > > web? ;-) > > Reason I brought this up is that I plan to use mysql. Mysql has those > AUTO INCREMENT fields and I want to insert a record and immediately call > last_index_id() to get the newly inserted row. If I do this is just one > and only one action, I may be able to prevent a timing/race condition by > which last_index_id() may accidentally be returned from the wrong insert. > I definitely want to prevent that from happening. Then have the method that inserts the record return the last_index_id and declare that method to be synchronized. If that's all the Action's perform method does, then you can declare it to be synchronized, but it's probably cleaner to put the method on some sort of DAO class. -- To unsubscribe, e-mail: For additional commands, e-mail: