Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 40151 invoked from network); 1 Feb 2005 19:10:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 1 Feb 2005 19:10:02 -0000 Received: (qmail 96393 invoked by uid 500); 1 Feb 2005 19:09:33 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 96344 invoked by uid 500); 1 Feb 2005 19:09:33 -0000 Mailing-List: contact user-help@struts.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 user@struts.apache.org Received: (qmail 96294 invoked by uid 99); 1 Feb 2005 19:09:32 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: error (hermes.apache.org: local policy) Received: from chiron.lunarpages.com (HELO chiron.lunarpages.com) (64.235.234.14) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 01 Feb 2005 11:09:27 -0800 Received: from chiron.lunarpages.com ([64.235.234.14]) by chiron.lunarpages.com with esmtpa (Exim 4.44) id 1Cw3Og-0000lM-Cf for user@struts.apache.org; Tue, 01 Feb 2005 11:09:10 -0800 Message-ID: <32558929.1107284950168.JavaMail.root@chiron.lunarpages.com> Date: Tue, 1 Feb 2005 11:09:10 -0800 (PST) From: fzlists@omnytex.com To: user@struts.apache.org Subject: Re: general Thread disscussion Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_10_21489256.1107284950089" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - chiron.lunarpages.com X-AntiAbuse: Original Domain - struts.apache.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - omnytex.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ------=_Part_10_21489256.1107284950089 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit On Tue, February 1, 2005 2:01 pm, listed@gmx.net said: > Thank you for your detailed reply. Its really helpfull but i had two > questions: I try :) >>... and it may even be forbidden by J2EE, but... doing it is OK if you >> are careful a > > I had a look in the J2EE-Specification but i can't found the point where > this Topic is handled. Do you know where? To be honest, I've only heard this in the past few days. I didn't know that, generically, writing files was "forbidden" by J2EE. I knew it was something you generally want to avoid from a webapp for other reasons, but it's news to me too :) So no, I don't have any reference I can point you to. I'd be interested in such a reference myself! >>Also, you NEVER want to hold references to any request-oriented resources >> (in fact, your thread shouldn't even USE them, shouldn't even be aware >> that it's running in a servlet container, if possible). > > Does this include ressources with synchronized-operations? > For example a static HashMap with some Data. > Some Client read of this HashMap (without synchronized) and the thread > wrote with the synchronized-Expression in the HashMap Just want to be sure I follow... Do you mean a case where you have a class along these lines: public class myData { public static HashMap data = new HashMap(); } ... and you might be reading and/or writing from this during the course of processing a reqeust AS WELL AS from a background thread? If that's the question, the answer is you need to be very careful. You can synchronize all access to the HashMap, but then you are introducing a bottleneck into the system at best, and a potential deadlock or any one of the other multitude of thread contention issues that confuse the hell out of most of us when they crop up! If your static information is read-only, you have no issue of course. I do this in that application I was talking about... I have a class almost identical to what you see above except that the HashMap is private and I have a getter/setter pair. It's never altered during the run of the application though, after startup anyway, so no problem. If it could be altered though, that would change matters. > Greets Felix Hope that helps! -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com ------=_Part_10_21489256.1107284950089 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org ------=_Part_10_21489256.1107284950089--