Return-Path: Delivered-To: apmail-logging-log4j-dev-archive@www.apache.org Received: (qmail 91261 invoked from network); 7 Jul 2005 01:56:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Jul 2005 01:56:01 -0000 Received: (qmail 53609 invoked by uid 500); 7 Jul 2005 01:56:00 -0000 Delivered-To: apmail-logging-log4j-dev-archive@logging.apache.org Received: (qmail 53579 invoked by uid 500); 7 Jul 2005 01:55:59 -0000 Mailing-List: contact log4j-dev-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@logging.apache.org Received: (qmail 53559 invoked by uid 99); 7 Jul 2005 01:55:58 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jul 2005 18:55:50 -0700 Received: by ajax.apache.org (Postfix, from userid 99) id 5208B13; Thu, 7 Jul 2005 03:55:47 +0200 (CEST) From: bugzilla@apache.org To: log4j-dev@logging.apache.org Subject: DO NOT REPLY [Bug 35052] - Problem with String.intern() in CategoryKey X-Bugzilla-Reason: AssignedTo Message-Id: <20050707015547.5208B13@ajax.apache.org> Date: Thu, 7 Jul 2005 03:55:47 +0200 (CEST) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG� RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND� INSERTED IN THE BUG DATABASE. http://issues.apache.org/bugzilla/show_bug.cgi?id=35052 ------- Additional Comments From mwomack@apache.org 2005-07-07 03:55 ------- So, this is the code for CategoryKey: class CategoryKey { String name; int hashCache; CategoryKey(String name) { this.name = name.intern(); hashCache = name.hashCode(); } final public int hashCode() { return hashCache; } final public boolean equals(Object rArg) { if(this == rArg) return true; if(rArg != null && CategoryKey.class == rArg.getClass()) return name == ((CategoryKey)rArg ).name; else return false; } } I think we are using the String.intern() call so that we can do the == between the two CategoryKey objects. Theoretically the String.intern() call will return the same String object for the same string value. I am assuming that using this instead of String.equals() is the speed increase. But I don't understand why this is really an issue. Only one version of the String should be added/created in the StringTable. Once a given logger has been created, no more entries to the StringTable should be added related to that logger. Are you creating that many unique Loggers over time? -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-dev-help@logging.apache.org