Return-Path: Delivered-To: apmail-lucene-hadoop-dev-archive@locus.apache.org Received: (qmail 80747 invoked from network); 25 Jul 2006 07:31:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 25 Jul 2006 07:31:41 -0000 Received: (qmail 16285 invoked by uid 500); 25 Jul 2006 07:31:40 -0000 Delivered-To: apmail-lucene-hadoop-dev-archive@lucene.apache.org Received: (qmail 16194 invoked by uid 500); 25 Jul 2006 07:31:40 -0000 Mailing-List: contact hadoop-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hadoop-dev@lucene.apache.org Delivered-To: mailing list hadoop-dev@lucene.apache.org Received: (qmail 16185 invoked by uid 99); 25 Jul 2006 07:31:40 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Jul 2006 00:31:40 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Jul 2006 00:31:39 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 2345941000A for ; Tue, 25 Jul 2006 07:29:15 +0000 (GMT) Message-ID: <13742551.1153812555134.JavaMail.jira@brutus> Date: Tue, 25 Jul 2006 00:29:15 -0700 (PDT) From: "Doug Cutting (JIRA)" To: hadoop-dev@lucene.apache.org Subject: [jira] Commented: (HADOOP-367) Static blocks do not automatically run when a class is loaded in Java 5.0 In-Reply-To: <22771983.1153174453937.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/HADOOP-367?page=comments#action_12423251 ] Doug Cutting commented on HADOOP-367: ------------------------------------- Will the setAccessable trick used in JobConf.newInstance() work here too? I hope it is possible to have non-public classes as parameters in non-public RPC protocols. For implementation flexibility we'd like to keep some protocols package-protected, so that our only back-compatibility burdens are public, client APIs. > Static blocks do not automatically run when a class is loaded in Java 5.0 > ------------------------------------------------------------------------- > > Key: HADOOP-367 > URL: http://issues.apache.org/jira/browse/HADOOP-367 > Project: Hadoop > Issue Type: Bug > Components: dfs > Affects Versions: 0.4.0 > Environment: Java 5.0 > Reporter: Benjamin Reed > > There seems to be a change that happened between 1.4 and 1.5 with respect to static initializers. I can't find this documented, but I can reproduce with a very simple program. Basically, a static initializer is not called unless a static member/method of the class is accessed or an instance is created. This is actually what the JLS says, but until 1.5 the static initializers ran when the class was loaded. Note that this behavior only occurs when running with the 1.5 JRE AND compiling for 1.5. > For many Writables this isn't an issue, so the fallback behavior of the WritableFactory works, but Block is package private, so loadEdits fails when called from org.apache.hadoop.io.ArrayWritable.readFields() yielding the following trace: > Caused by: java.lang.RuntimeException: java.lang.IllegalAccessException: Class org.apache.hadoop.io.WritableFactories can not access a member of class org.apache.hadoop.dfs.Block with modifiers "public" > at org.apache.hadoop.io.WritableFactories.newInstance(WritableFactories.java:49) > at org.apache.hadoop.io.ArrayWritable.readFields(ArrayWritable.java:81) > at org.apache.hadoop.dfs.FSDirectory.loadFSEdits(FSDirectory.java:532) > at org.apache.hadoop.dfs.FSDirectory.loadFSImage(FSDirectory.java:470) > at org.apache.hadoop.dfs.FSDirectory.(FSDirectory.java:307) > at org.apache.hadoop.dfs.FSNamesystem.(FSNamesystem.java:177) > at org.apache.hadoop.dfs.NameNode.(NameNode.java:91) > at org.apache.hadoop.dfs.NameNode.(NameNode.java:84) > at org.apache.hadoop.dfs.NameNode.main(NameNode.java:491) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira