Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 4074 invoked from network); 9 May 2006 20:05:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 May 2006 20:05:56 -0000 Received: (qmail 82399 invoked by uid 500); 9 May 2006 20:05:51 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 82152 invoked by uid 500); 9 May 2006 20:05:50 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 82091 invoked by uid 99); 9 May 2006 20:05:49 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 May 2006 13:05:49 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 09 May 2006 13:05:47 -0700 Received: (qmail 3799 invoked by uid 65534); 9 May 2006 20:05:25 -0000 Message-ID: <20060509200525.3795.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r405520 - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/ref/ReferenceQueue.java Date: Tue, 09 May 2006 20:05:25 -0000 To: harmony-commits@incubator.apache.org From: tellison@apache.org X-Mailer: svnmailer-1.0.8 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: tellison Date: Tue May 9 13:05:23 2006 New Revision: 405520 URL: http://svn.apache.org/viewcvs?rev=405520&view=rev Log: Generic uplift for Reference and ReferenceQueue. Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/ref/ReferenceQueue.java Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/ref/ReferenceQueue.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/ref/ReferenceQueue.java?rev=405520&r1=405519&r2=405520&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/ref/ReferenceQueue.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/ref/ReferenceQueue.java Tue May 9 13:05:23 2006 @@ -1,4 +1,4 @@ -/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable +/* Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,9 @@ * * @since JDK1.2 */ -public class ReferenceQueue extends Object { - private Reference[] references; +public class ReferenceQueue extends Object { + + private Reference[] references; private int head, tail; @@ -40,8 +41,8 @@ * * @return Reference next available Reference or NULL. */ - public Reference poll() { - Reference ref; + public Reference poll() { + Reference ref; synchronized (this) { if (empty) { @@ -67,7 +68,7 @@ * @exception InterruptedException * to interrupt the wait. */ - public Reference remove() throws InterruptedException { + public Reference remove() throws InterruptedException { return remove(0L); } @@ -84,13 +85,13 @@ * if the wait period is negative. InterruptedException to * interrupt the wait. */ - public Reference remove(long timeout) throws IllegalArgumentException, + public Reference remove(long timeout) throws IllegalArgumentException, InterruptedException { if (timeout < 0) { throw new IllegalArgumentException(); } - Reference ref; + Reference ref; synchronized (this) { if (empty) { wait(timeout); @@ -120,12 +121,13 @@ * @return boolean true if reference is enqueued. false if reference failed * to enqueue. */ - boolean enqueue(Reference reference) { + boolean enqueue(Reference reference) { synchronized (this) { if (!empty && head == tail) { /* Queue is full - grow */ int newQueueSize = (int) (references.length * 1.10); - Reference newQueue[] = new Reference[newQueueSize]; + Reference newQueue[] = + (Reference[])new Reference[newQueueSize]; System.arraycopy(references, head, newQueue, 0, references.length - head); if (tail > 0) { @@ -150,7 +152,7 @@ * Constructs a new instance of this class. */ public ReferenceQueue() { - references = new Reference[DEFAULT_QUEUE_SIZE]; + references = (Reference[])new Reference[DEFAULT_QUEUE_SIZE]; head = 0; tail = 0; empty = true;