Return-Path: Delivered-To: apmail-felix-commits-archive@www.apache.org Received: (qmail 13955 invoked from network); 27 Oct 2010 06:53:59 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 27 Oct 2010 06:53:59 -0000 Received: (qmail 563 invoked by uid 500); 27 Oct 2010 06:53:59 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 473 invoked by uid 500); 27 Oct 2010 06:53:57 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 466 invoked by uid 99); 27 Oct 2010 06:53:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Oct 2010 06:53:56 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Oct 2010 06:53:56 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D8EB023889B2; Wed, 27 Oct 2010 06:52:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1027832 - in /felix/trunk/coordinator: pom.xml src/main/java/org/apache/felix/coordination/impl/CoordinationImpl.java Date: Wed, 27 Oct 2010 06:52:59 -0000 To: commits@felix.apache.org From: fmeschbe@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101027065259.D8EB023889B2@eris.apache.org> Author: fmeschbe Date: Wed Oct 27 06:52:59 2010 New Revision: 1027832 URL: http://svn.apache.org/viewvc?rev=1027832&view=rev Log: Use target of "jsr14" for compilation with the following effects: - Source level 5 indicates support for generics - Target jsr14 compiles JDK 14 (Class version 48) classes - Take care to not use other Java 5 features like Annotations and Enum (Thus replace enum State with plain old int constants) Modified: felix/trunk/coordinator/pom.xml felix/trunk/coordinator/src/main/java/org/apache/felix/coordination/impl/CoordinationImpl.java Modified: felix/trunk/coordinator/pom.xml URL: http://svn.apache.org/viewvc/felix/trunk/coordinator/pom.xml?rev=1027832&r1=1027831&r2=1027832&view=diff ============================================================================== --- felix/trunk/coordinator/pom.xml (original) +++ felix/trunk/coordinator/pom.xml Wed Oct 27 06:52:59 2010 @@ -42,7 +42,7 @@ maven-compiler-plugin 5 - 5 + jsr14 Modified: felix/trunk/coordinator/src/main/java/org/apache/felix/coordination/impl/CoordinationImpl.java URL: http://svn.apache.org/viewvc/felix/trunk/coordinator/src/main/java/org/apache/felix/coordination/impl/CoordinationImpl.java?rev=1027832&r1=1027831&r2=1027832&view=diff ============================================================================== --- felix/trunk/coordinator/src/main/java/org/apache/felix/coordination/impl/CoordinationImpl.java (original) +++ felix/trunk/coordinator/src/main/java/org/apache/felix/coordination/impl/CoordinationImpl.java Wed Oct 27 06:52:59 2010 @@ -31,19 +31,17 @@ import org.apache.felix.service.coordina @SuppressWarnings("deprecation") public class CoordinationImpl implements Coordination { - private enum State { - /** Active */ - ACTIVE, + /** Active */ + private static final int ACTIVE = 1; - /** Coordination termination started */ - TERMINATING, + /** Coordination termination started */ + private static final int TERMINATING = 2; - /** Coordination completed */ - TERMINATED, + /** Coordination completed */ + private static final int TERMINATED = 3; - /** Coordination failed */ - FAILED; - } + /** Coordination failed */ + private static final int FAILED = 4; private final CoordinationMgr mgr; @@ -56,12 +54,11 @@ public class CoordinationImpl implements /** * Access to this field must be synchronized as long as the expected state - * is {@link State#ACTIVE}. Once the state has changed, further updates to - * this instance will not take place any more and the state will only be - * modified by the thread successfully setting the state to - * {@link State#TERMINATING}. + * is {@link #ACTIVE}. Once the state has changed, further updates to this + * instance will not take place any more and the state will only be modified + * by the thread successfully setting the state to {@link #TERMINATING}. */ - private volatile State state; + private volatile int state; private int mustFail; @@ -81,7 +78,7 @@ public class CoordinationImpl implements this.id = id; this.name = name; this.mustFail = 0; - this.state = State.ACTIVE; + this.state = ACTIVE; this.participants = new ArrayList(); this.variables = new HashMap, Object>(); this.timeOutInMs = -defaultTimeOutInMs; @@ -144,7 +141,7 @@ public class CoordinationImpl implements } public boolean terminate() { - if (state == State.ACTIVE) { + if (state == ACTIVE) { try { end(); return true; @@ -165,7 +162,7 @@ public class CoordinationImpl implements * the coordination is in the process of terminating due to a failure. */ public boolean isFailed() { - return state == State.FAILED; + return state == FAILED; } /** @@ -175,7 +172,7 @@ public class CoordinationImpl implements * the coordination is in the process of terminating. */ public boolean isTerminated() { - return state == State.TERMINATED; + return state == TERMINATED; } public void addTimeout(long timeOutInMs) { @@ -210,7 +207,7 @@ public class CoordinationImpl implements // synchronize access to the state to prevent it from being changed // while adding the participant synchronized (this) { - if (state == State.ACTIVE) { + if (state == ACTIVE) { if (!participants.contains(p)) { participants.add(p); } @@ -224,7 +221,7 @@ public class CoordinationImpl implements // synchronize access to the state to prevent it from being changed // while we create a copy of the participant list synchronized (this) { - if (state == State.ACTIVE) { + if (state == ACTIVE) { return new ArrayList(participants); } } @@ -249,8 +246,8 @@ public class CoordinationImpl implements * thread and no further termination processing must take place. */ private synchronized boolean startTermination() { - if (state == State.ACTIVE) { - state = State.TERMINATING; + if (state == ACTIVE) { + state = TERMINATING; mgr.unregister(this); scheduleTimeout(-1); return true; @@ -283,7 +280,7 @@ public class CoordinationImpl implements // release the participant for other coordinations mgr.releaseParticipant(part); } - state = State.TERMINATED; + state = TERMINATED; return reason; } @@ -306,7 +303,7 @@ public class CoordinationImpl implements // release the participant for other coordinations mgr.releaseParticipant(part); } - state = State.FAILED; + state = FAILED; } /**