Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 29529 invoked from network); 17 Nov 2009 16:26:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Nov 2009 16:26:08 -0000 Received: (qmail 35891 invoked by uid 500); 17 Nov 2009 16:26:04 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 35819 invoked by uid 500); 17 Nov 2009 16:26:04 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 35621 invoked by uid 99); 17 Nov 2009 16:26:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Nov 2009 16:26:03 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=SPF_SOFTFAIL X-Spam-Check-By: apache.org Received-SPF: softfail (nike.apache.org: transitioning domain of pid@pidster.com does not designate 74.125.78.145 as permitted sender) Received: from [74.125.78.145] (HELO ey-out-1920.google.com) (74.125.78.145) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Nov 2009 16:25:54 +0000 Received: by ey-out-1920.google.com with SMTP id 3so2119162eyh.0 for ; Tue, 17 Nov 2009 08:25:33 -0800 (PST) Received: by 10.213.2.70 with SMTP id 6mr1850995ebi.30.1258475133748; Tue, 17 Nov 2009 08:25:33 -0800 (PST) Received: from phoenix.config (94-193-98-41.zone7.bethere.co.uk [94.193.98.41]) by mx.google.com with ESMTPS id 10sm660887eyz.27.2009.11.17.08.25.29 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 17 Nov 2009 08:25:31 -0800 (PST) Message-ID: <4B02CE75.1060900@pidster.com> Date: Tue, 17 Nov 2009 16:25:25 +0000 From: Pid Reply-To: pid@pidster.com Organization: Pidster Inc User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-GB; rv:1.9.1.1) Gecko/20090715 Thunderbird/3.0b3 MIME-Version: 1.0 To: users@tomcat.apache.org Subject: Re: synchronizing in tomcat References: <9948385e0911170743q536510eet31331773c931f526@mail.gmail.com> In-Reply-To: <9948385e0911170743q536510eet31331773c931f526@mail.gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org On 17/11/2009 15:43, David Bala�ic wrote: > Hi! > > Does tomcat offer any mechanism for locking servlet executions? > > So if one servlet does: > - get 10 EUR from account 1 (read account 1 balance; substract 10; > store new balance) > - add 10 EUR to account 2 (...) > > How can I make sure no other servlet does (read account 1 balance; > sustract 10; store new balance) at the same > time and cause lost account money? > > The account data is in a database, accessed over hibernate (or > directly, if needed). The term you are looking for is "transaction". GIYF. p > Regards, > David > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org