[jboss-cvs] JBossAS SVN: r84635 - in projects/ejb3/trunk: concurrency and 22 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Feb 23 11:07:43 EST 2009
Author: wolfc
Date: 2009-02-23 11:07:43 -0500 (Mon, 23 Feb 2009)
New Revision: 84635
Added:
projects/ejb3/trunk/concurrency/
projects/ejb3/trunk/concurrency/.classpath
projects/ejb3/trunk/concurrency/.project
projects/ejb3/trunk/concurrency/.settings/
projects/ejb3/trunk/concurrency/.settings/org.eclipse.jdt.core.prefs
projects/ejb3/trunk/concurrency/.settings/org.maven.ide.eclipse.prefs
projects/ejb3/trunk/concurrency/pom.xml
projects/ejb3/trunk/concurrency/src/
projects/ejb3/trunk/concurrency/src/main/
projects/ejb3/trunk/concurrency/src/main/java/
projects/ejb3/trunk/concurrency/src/main/java/org/
projects/ejb3/trunk/concurrency/src/main/java/org/jboss/
projects/ejb3/trunk/concurrency/src/main/java/org/jboss/ejb3/
projects/ejb3/trunk/concurrency/src/main/java/org/jboss/ejb3/concurrency/
projects/ejb3/trunk/concurrency/src/main/java/org/jboss/ejb3/concurrency/ContainerManagedConcurrencyInterceptor.java
projects/ejb3/trunk/concurrency/src/main/java/org/jboss/ejb3/concurrency/ContainerManagedConcurrencyInterceptorFactory.java
projects/ejb3/trunk/concurrency/src/main/java/org/jboss/ejb3/concurrency/EJBReadWriteLock.java
projects/ejb3/trunk/concurrency/src/test/
projects/ejb3/trunk/concurrency/src/test/java/
projects/ejb3/trunk/concurrency/src/test/java/org/
projects/ejb3/trunk/concurrency/src/test/java/org/jboss/
projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/
projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/concurrency/
projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/concurrency/test/
projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/concurrency/test/common/
projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/concurrency/test/common/AbstractBootstrapTestCase.java
projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/concurrency/test/coverage/
projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/concurrency/test/coverage/SimpleBean.java
projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/concurrency/test/coverage/unit/
projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/concurrency/test/coverage/unit/CoverageTestCase.java
projects/ejb3/trunk/concurrency/src/test/resources/
projects/ejb3/trunk/concurrency/src/test/resources/conf/
projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap.xml
projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/
projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/aop-deployers.xml
projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/aop.xml
projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/classloader-deployers.xml
projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/classloader.xml
projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/jmx-jdk.xml
projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/maindeployer.xml
projects/ejb3/trunk/concurrency/src/test/resources/deploy/
projects/ejb3/trunk/concurrency/src/test/resources/deploy/concurrency-aop.xml
projects/ejb3/trunk/concurrency/src/test/resources/log4j.xml
Log:
EJBTHREE-1735: implement bean concurrency
Property changes on: projects/ejb3/trunk/concurrency
___________________________________________________________________
Name: svn:ignore
+ eclipse-target
target
FileHandler@*
Added: projects/ejb3/trunk/concurrency/.classpath
===================================================================
--- projects/ejb3/trunk/concurrency/.classpath (rev 0)
+++ projects/ejb3/trunk/concurrency/.classpath 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,8 @@
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/test/java" output="eclipse-target/tests-classes"/>
+ <classpathentry kind="src" path="src/test/resources" output="eclipse-target/tests-classes" excluding="**/*.java"/>
+ <classpathentry kind="output" path="eclipse-target/classes"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+</classpath>
\ No newline at end of file
Added: projects/ejb3/trunk/concurrency/.project
===================================================================
--- projects/ejb3/trunk/concurrency/.project (rev 0)
+++ projects/ejb3/trunk/concurrency/.project 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,19 @@
+<projectDescription>
+ <name>jboss-ejb3-concurreny</name>
+ <comment>JBoss EJB 3.x Concurrency provides the mechanism for container
+ manager concurrency as specified in EJB 3.1 PFD2 4.8.5
+ Singleton Concurrency.</comment>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Added: projects/ejb3/trunk/concurrency/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/ejb3/trunk/concurrency/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/ejb3/trunk/concurrency/.settings/org.eclipse.jdt.core.prefs 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,5 @@
+#Mon Feb 23 09:59:30 CET 2009
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
Added: projects/ejb3/trunk/concurrency/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/ejb3/trunk/concurrency/.settings/org.maven.ide.eclipse.prefs (rev 0)
+++ projects/ejb3/trunk/concurrency/.settings/org.maven.ide.eclipse.prefs 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,8 @@
+#Mon Feb 23 10:06:44 CET 2009
+activeProfiles=eclipse
+eclipse.preferences.version=1
+fullBuildGoals=
+includeModules=false
+resolveWorkspaceProjects=false
+resourceFilterGoals=
+version=1
Added: projects/ejb3/trunk/concurrency/pom.xml
===================================================================
--- projects/ejb3/trunk/concurrency/pom.xml (rev 0)
+++ projects/ejb3/trunk/concurrency/pom.xml 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,161 @@
+<!--
+ vi:ts=2:sw=2:expandtab:
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-build</artifactId>
+ <version>1.0.2-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+
+ <!-- Maven POM Model Version -->
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- Artifact Information -->
+ <artifactId>jboss-ejb3-concurreny</artifactId>
+ <packaging>jar</packaging>
+ <version>0.1.0-SNAPSHOT</version>
+ <name>JBoss EJB 3.x Concurrency</name>
+ <description>
+ JBoss EJB 3.x Concurrency provides the mechanism for container
+ manager concurrency as specified in EJB 3.1 PFD2 4.8.5
+ Singleton Concurrency.
+ </description>
+ <url>http://labs.jboss.com/jbossejb3/</url>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <executable>${JDK6_HOME}/bin/javac</executable>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>enforce-jdk6</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireProperty>
+ <property>env.JDK6_HOME</property>
+ <message>JDK6_HOME is not set</message>
+ </requireProperty>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>once</forkMode>
+ <jvm>${JDK6_HOME}/bin/java</jvm>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <version>2.1.0.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ <version>2.0.4.GA</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop-asintegration-mc</artifactId>
+ <version>${version.org.jboss.aop_jboss-aop}</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-test</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-system-jmx</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>org.jboss.bootstrap</groupId>
+ <artifactId>jboss-bootstrap</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <version>2.0.5.GA</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-aop-deployers</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-api</artifactId>
+ <version>3.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-interceptors</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-aop-mc-int</artifactId>
+ <version>2.0.0.CR5</version>
+ </dependency>
+ -->
+ <!--
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </dependency>
+ -->
+ </dependencies>
+</project>
Added: projects/ejb3/trunk/concurrency/src/main/java/org/jboss/ejb3/concurrency/ContainerManagedConcurrencyInterceptor.java
===================================================================
--- projects/ejb3/trunk/concurrency/src/main/java/org/jboss/ejb3/concurrency/ContainerManagedConcurrencyInterceptor.java (rev 0)
+++ projects/ejb3/trunk/concurrency/src/main/java/org/jboss/ejb3/concurrency/ContainerManagedConcurrencyInterceptor.java 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.concurrency;
+
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+
+import javax.ejb.AccessTimeout;
+import javax.ejb.ConcurrentAccessTimeoutException;
+import javax.ejb.LockType;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class ContainerManagedConcurrencyInterceptor implements Interceptor
+{
+ private ReadWriteLock readWriteLock = new EJBReadWriteLock();
+
+ private AccessTimeout getAccessTimeout(Invocation invocation)
+ {
+ AccessTimeout timeout = (AccessTimeout) invocation.resolveAnnotation(AccessTimeout.class);
+ if(timeout == null)
+ timeout = (AccessTimeout) invocation.resolveClassAnnotation(AccessTimeout.class);
+ return timeout;
+ }
+
+ private Lock getLock(Invocation invocation)
+ {
+ LockType lockType = getLockType(invocation);
+ switch(lockType)
+ {
+ case READ:
+ return readWriteLock.readLock();
+ case WRITE:
+ return readWriteLock.writeLock();
+ }
+ throw new IllegalStateException("Illegal lock type " + lockType + " on " + invocation);
+ }
+
+ private LockType getLockType(Invocation invocation)
+ {
+ javax.ejb.Lock lock = (javax.ejb.Lock) invocation.resolveAnnotation(javax.ejb.Lock.class);
+ if(lock == null)
+ lock = (javax.ejb.Lock) invocation.resolveClassAnnotation(javax.ejb.Lock.class);
+ // 4.8.5.4 By default, the value of the lock associated with a
+ // method of a bean with container managed concurrency demarcation is Write(exclusive), and the concur-
+ // rency lock attribute does not need to be explicitly specified in this case.
+ if(lock == null)
+ return LockType.WRITE;
+ return lock.value();
+ }
+
+ // TODO: this is a no-brainer and should be part of an AbstractInterceptor
+ public String getName()
+ {
+ return getClass().getName();
+ }
+
+ @Override
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ Lock lock = getLock(invocation);
+ // TODO: these should come from somewhere else
+ // Note that in violation of spec, we'll never wait indefinitely!
+ long time = 5;
+ TimeUnit unit = TimeUnit.MINUTES;
+ AccessTimeout timeout = getAccessTimeout(invocation);
+ if(timeout != null)
+ {
+ time = timeout.value();
+ unit = timeout.unit();
+ }
+ boolean success = lock.tryLock(time, unit);
+ if(!success)
+ throw new ConcurrentAccessTimeoutException("EJB 3.1 PFD2 4.8.5.5.1 concurrent access timeout on " + invocation);
+ try
+ {
+ return invocation.invokeNext();
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
+}
Added: projects/ejb3/trunk/concurrency/src/main/java/org/jboss/ejb3/concurrency/ContainerManagedConcurrencyInterceptorFactory.java
===================================================================
--- projects/ejb3/trunk/concurrency/src/main/java/org/jboss/ejb3/concurrency/ContainerManagedConcurrencyInterceptorFactory.java (rev 0)
+++ projects/ejb3/trunk/concurrency/src/main/java/org/jboss/ejb3/concurrency/ContainerManagedConcurrencyInterceptorFactory.java 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.concurrency;
+
+import javax.ejb.ConcurrencyManagement;
+import javax.ejb.ConcurrencyManagementType;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.InstanceAdvisor;
+import org.jboss.ejb3.interceptors.aop.AbstractInterceptorFactory;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class ContainerManagedConcurrencyInterceptorFactory extends AbstractInterceptorFactory
+{
+ /*
+ * By default a singleton container must have container managed concurrency, this can be setup
+ * within aop.xml instead of forcing it through an interceptor factory.
+ */
+
+ @Override
+ public Object createPerInstance(Advisor advisor, InstanceAdvisor instanceAdvisor)
+ {
+ if(!isContainerManagedConcurrency(advisor))
+ return null;
+ return new ContainerManagedConcurrencyInterceptor();
+ }
+
+ private boolean isContainerManagedConcurrency(Advisor advisor)
+ {
+ ConcurrencyManagement cm = (ConcurrencyManagement) advisor.resolveAnnotation(ConcurrencyManagement.class);
+ // 4.8.5.3 By default, a singleton bean has container managed concurrency demarcation if the concurrency management type is not specified.
+ if(cm == null)
+ return true;
+ return cm.value() == ConcurrencyManagementType.CONTAINER;
+ }
+}
Added: projects/ejb3/trunk/concurrency/src/main/java/org/jboss/ejb3/concurrency/EJBReadWriteLock.java
===================================================================
--- projects/ejb3/trunk/concurrency/src/main/java/org/jboss/ejb3/concurrency/EJBReadWriteLock.java (rev 0)
+++ projects/ejb3/trunk/concurrency/src/main/java/org/jboss/ejb3/concurrency/EJBReadWriteLock.java 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,194 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.concurrency;
+
+import java.io.Serializable;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import javax.ejb.IllegalLoopbackException;
+
+/**
+ * Make sure we throw an IllegalLoopbackException on lock upgrade from read to write.
+ *
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class EJBReadWriteLock implements ReadWriteLock, Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private ThreadLocal<Integer> readLockCount = new ThreadLocal<Integer>();
+
+ private ReentrantReadWriteLock delegate = new ReentrantReadWriteLock();
+
+ private Lock readLock = new ReadLock();
+ private Lock writeLock = new WriteLock();
+
+ public class ReadLock implements Lock, Serializable
+ {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void lock()
+ {
+ delegate.readLock().lock();
+ incReadLockCount();
+ }
+
+ @Override
+ public void lockInterruptibly() throws InterruptedException
+ {
+ delegate.readLock().lockInterruptibly();
+ incReadLockCount();
+ }
+
+ @Override
+ public Condition newCondition()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean tryLock()
+ {
+ if(delegate.readLock().tryLock())
+ {
+ incReadLockCount();
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean tryLock(long time, TimeUnit unit) throws InterruptedException
+ {
+ if(delegate.readLock().tryLock(time, unit))
+ {
+ incReadLockCount();
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void unlock()
+ {
+ delegate.readLock().unlock();
+ decReadLockCount();
+ }
+
+ }
+
+ public class WriteLock implements Lock, Serializable
+ {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void lock()
+ {
+ checkLoopback();
+ delegate.writeLock().lock();
+ }
+
+ @Override
+ public void lockInterruptibly() throws InterruptedException
+ {
+ checkLoopback();
+ delegate.writeLock().lockInterruptibly();
+ }
+
+ @Override
+ public Condition newCondition()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean tryLock()
+ {
+ checkLoopback();
+ return delegate.writeLock().tryLock();
+ }
+
+ @Override
+ public boolean tryLock(long time, TimeUnit unit) throws InterruptedException
+ {
+ checkLoopback();
+ return delegate.writeLock().tryLock(time, unit);
+ }
+
+ @Override
+ public void unlock()
+ {
+ delegate.writeLock().unlock();
+ }
+ }
+
+ private void checkLoopback()
+ {
+ Integer current = readLockCount.get();
+ if(current != null)
+ {
+ assert current.intValue() > 0 : "readLockCount is set, but to 0";
+ throw new IllegalLoopbackException("EJB 3.1 PFD2 4.8.5.1.1 upgrading from read to write lock is not allowed");
+ }
+ }
+
+ private void decReadLockCount()
+ {
+ Integer current = readLockCount.get();
+ int next;
+ assert current != null : "can't decrease, readLockCount is not set";
+ next = current.intValue() - 1;
+ if(next == 0)
+ readLockCount.remove();
+ else
+ readLockCount.set(new Integer(next));
+ }
+
+ private void incReadLockCount()
+ {
+ Integer current = readLockCount.get();
+ int next;
+ if(current == null)
+ next = 1;
+ else
+ next = current.intValue() + 1;
+ readLockCount.set(new Integer(next));
+ }
+
+ @Override
+ public Lock readLock()
+ {
+ return readLock;
+ }
+
+ @Override
+ public Lock writeLock()
+ {
+ return writeLock;
+ }
+}
Added: projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/concurrency/test/common/AbstractBootstrapTestCase.java
===================================================================
--- projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/concurrency/test/common/AbstractBootstrapTestCase.java (rev 0)
+++ projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/concurrency/test/common/AbstractBootstrapTestCase.java 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,161 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.concurrency.test.common;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.util.List;
+import java.util.Properties;
+
+import org.jboss.bootstrap.microcontainer.ServerImpl;
+import org.jboss.bootstrap.spi.ServerConfig;
+import org.jboss.bootstrap.spi.microcontainer.MCServer;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public abstract class AbstractBootstrapTestCase
+{
+ private static Logger log = Logger.getLogger(AbstractBootstrapTestCase.class);
+
+ private static MCServer server;
+ private static MainDeployer mainDeployer;
+
+ @AfterClass
+ public static void afterClass() throws Exception
+ {
+ if(server != null)
+ {
+ if(server.isStarted())
+ server.shutdown();
+ }
+ }
+
+ @BeforeClass
+ public static void beforeClass() throws Exception
+ {
+ server = new ServerImpl();
+
+ Properties props = new Properties();
+ String dir = mkdir("target/bootstrap");
+ mkdir("target/bootstrap/server/default");
+ //mkdir("target/bootstrap/server/default/deploy");
+ mkdir("target/bootstrap/server/default/data");
+ mkdir("target/bootstrap/server/default/log");
+ mkdir("target/bootstrap/server/default/tmp");
+ mkdir("target/bootstrap/server/default/tmp/deploy");
+ mkdir("target/bootstrap/server/default/tmp/native");
+ log.info("dir = " + dir);
+ props.put(ServerConfig.HOME_DIR, dir);
+ props.put(ServerConfig.SERVER_CONFIG_URL, findDir("src/test/resources/conf"));
+ server.init(props);
+
+ server.start();
+
+ mainDeployer = (MainDeployer) server.getKernel().getController().getContext("MainDeployer", ControllerState.INSTALLED).getTarget();
+
+// URL url = new File("src/main/resources").toURI().toURL();
+// log.debug("url = " + url);
+// deploy(url);
+
+ // TODO: hack, use something similar to deploy directory
+// Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources("META-INF/jboss-beans.xml");
+// while(urls.hasMoreElements())
+// {
+// URL u = urls.nextElement();
+// URLConnection c = u.openConnection();
+// // skip src/test/resources (urgh)
+// if(!(c instanceof JarURLConnection))
+// continue;
+// JarURLConnection connection = (JarURLConnection) c;
+// URL jarFileURL = connection.getJarFileURL();
+// deploy(jarFileURL);
+// }
+
+ // TODO: another hack that simulates profile service going through deploy dir
+ VirtualFile deployDir = VFS.getRoot(findDirURI("src/test/resources/deploy"));
+ List<VirtualFile> candidates = deployDir.getChildren();
+ for(VirtualFile candidate : candidates)
+ {
+ deploy(candidate);
+ }
+
+// // Ehr, to deploy the persistence unit defined in src/test/resources (it's not a hack! it's a feature!)
+// deploy(AbstractBootstrapTestCase.class.getProtectionDomain().getCodeSource().getLocation());
+ }
+
+// protected static void deploy(URL url) throws DeploymentException, IOException
+// {
+// VirtualFile root = VFS.getRoot(url);
+// VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(root);
+// mainDeployer.deploy(deployment);
+// mainDeployer.checkComplete(deployment);
+// }
+
+ protected static void deploy(VirtualFile file) throws DeploymentException
+ {
+ VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(file);
+ mainDeployer.deploy(deployment);
+ mainDeployer.checkComplete(deployment);
+ }
+
+ private static String findDir(String path) throws IOException
+ {
+ return findDirURI(path).toString();
+ }
+
+ private static URI findDirURI(String path) throws IOException
+ {
+ File file = new File(path);
+ boolean success = file.isDirectory();
+ if(!success)
+ throw new IOException("failed to find " + path);
+ return file.toURI();
+ }
+
+ public <T> T getBean(String name, Class<T> expectedType)
+ {
+ // FIXME: check state
+ return expectedType.cast(server.getKernel().getController().getContext(name, null).getTarget());
+ }
+
+ private static String mkdir(String path) throws IOException
+ {
+ File file = new File(path);
+ boolean success = file.mkdirs() || file.isDirectory();
+ if(!success)
+ throw new IOException("failed to create " + path);
+ return file.toURI().toURL().toString();
+ }
+}
Added: projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/concurrency/test/coverage/SimpleBean.java
===================================================================
--- projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/concurrency/test/coverage/SimpleBean.java (rev 0)
+++ projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/concurrency/test/coverage/SimpleBean.java 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.concurrency.test.coverage;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static javax.ejb.LockType.READ;
+
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.ejb.AccessTimeout;
+import javax.ejb.Lock;
+
+import org.jboss.ejb3.interceptors.container.BeanContext;
+import org.jboss.ejb3.interceptors.direct.DirectContainer;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at AccessTimeout(5000)
+public class SimpleBean
+{
+ // Note this is an atomic because without the interceptor it'll be accessed by multiple threads
+ private AtomicInteger accessCount = new AtomicInteger(0);
+
+ private CyclicBarrier barrier = new CyclicBarrier(2);
+ private Semaphore semaphore = new Semaphore(0);
+
+ @AccessTimeout(1)
+ public int accessImmediately()
+ {
+ return accessCount.incrementAndGet();
+ }
+
+ public CyclicBarrier getBarrier()
+ {
+ return barrier;
+ }
+
+ public Semaphore getSemaphore()
+ {
+ return semaphore;
+ }
+
+ @Lock(READ)
+ public int read()
+ {
+ return accessCount.incrementAndGet();
+ }
+
+ @AccessTimeout(1)
+ @Lock(READ)
+ public int readImmediately()
+ {
+ return accessCount.incrementAndGet();
+ }
+
+ @Lock(READ)
+ public int readInto(DirectContainer<SimpleBean> container, BeanContext<SimpleBean> bean, String methodName) throws Throwable
+ {
+ assert bean.getInstance() == this;
+ // normally: ctx.getBusinessObject(Simple.class).method
+ Integer count = container.invoke(bean, methodName);
+ return count;
+ }
+
+ public String sayHello(String name)
+ {
+ return "Hi " + name;
+ }
+
+ public int waitOnSemaphore() throws BrokenBarrierException, InterruptedException, TimeoutException
+ {
+ barrier.await(5, SECONDS);
+ boolean success = semaphore.tryAcquire(5, SECONDS);
+ if(!success)
+ throw new RuntimeException("timeout");
+ return accessCount.incrementAndGet();
+ }
+
+ @Lock(READ)
+ public int waitRead() throws BrokenBarrierException, InterruptedException, TimeoutException
+ {
+ barrier.await(5, SECONDS);
+ boolean success = semaphore.tryAcquire(5, SECONDS);
+ if(!success)
+ throw new RuntimeException("timeout");
+ return accessCount.incrementAndGet();
+ }
+
+ public int write()
+ {
+ return accessCount.incrementAndGet();
+ }
+
+}
Added: projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/concurrency/test/coverage/unit/CoverageTestCase.java
===================================================================
--- projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/concurrency/test/coverage/unit/CoverageTestCase.java (rev 0)
+++ projects/ejb3/trunk/concurrency/src/test/java/org/jboss/ejb3/concurrency/test/coverage/unit/CoverageTestCase.java 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,220 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.concurrency.test.coverage.unit;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.util.Date;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import javax.ejb.ConcurrentAccessTimeoutException;
+import javax.ejb.IllegalLoopbackException;
+
+import org.jboss.ejb3.concurrency.test.common.AbstractBootstrapTestCase;
+import org.jboss.ejb3.concurrency.test.coverage.SimpleBean;
+import org.jboss.ejb3.interceptors.container.BeanContext;
+import org.jboss.ejb3.interceptors.direct.DirectContainer;
+import org.junit.Test;
+
+/**
+ * Try to touch as much code as possible. Don't check spec, if it's tested it exists.
+ *
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class CoverageTestCase extends AbstractBootstrapTestCase
+{
+ static class ContainerInvocationTask<B, T> implements Callable<T>
+ {
+ private DirectContainer<B> container;
+ private BeanContext<B> bean;
+ private String methodName;
+
+ ContainerInvocationTask(DirectContainer<B> container, BeanContext<B> bean, String methodName)
+ {
+ this.container = container;
+ this.bean = bean;
+ this.methodName = methodName;
+ }
+
+ @Override
+ public T call() throws Exception
+ {
+ try
+ {
+ Object o = container.invoke(bean, methodName);
+ return (T) o;
+ }
+ catch(Error e)
+ {
+ throw e;
+ }
+ catch(RuntimeException e)
+ {
+ throw e;
+ }
+ catch(Exception e)
+ {
+ throw e;
+ }
+ catch(Throwable t)
+ {
+ throw new Error(t);
+ }
+ }
+ }
+
+ /**
+ * 4.8.5.5.1 Concurrent access timeouts
+ */
+ @Test
+ public void testAccessTimeout() throws Throwable
+ {
+ ExecutorService service = Executors.newCachedThreadPool();
+
+ final DirectContainer<SimpleBean> container = new DirectContainer<SimpleBean>("SimpleBean", "Singleton Container", SimpleBean.class);
+
+ final BeanContext<SimpleBean> bean = container.construct();
+
+ Callable<Integer> task = new ContainerInvocationTask<SimpleBean, Integer>(container, bean, "waitOnSemaphore");
+ Future<Integer> future = service.submit(task);
+ bean.getInstance().getBarrier().await(5, SECONDS);
+
+ try
+ {
+ container.invoke(bean, "accessImmediately");
+ fail("Should have thrown " + ConcurrentAccessTimeoutException.class.getSimpleName());
+ }
+ catch(ConcurrentAccessTimeoutException e)
+ {
+ // good
+ }
+
+ bean.getInstance().getSemaphore().release();
+
+ int accessCount = future.get(5, SECONDS);
+ assertEquals(1, accessCount);
+ }
+
+ @Test
+ public void testMultipleRead() throws Throwable
+ {
+ ExecutorService service = Executors.newCachedThreadPool();
+
+ final DirectContainer<SimpleBean> container = new DirectContainer<SimpleBean>("SimpleBean", "Singleton Container", SimpleBean.class);
+
+ final BeanContext<SimpleBean> bean = container.construct();
+
+ Callable<Integer> task = new ContainerInvocationTask<SimpleBean, Integer>(container, bean, "waitRead");
+ Future<Integer> future = service.submit(task);
+ bean.getInstance().getBarrier().await(5, SECONDS);
+
+ Integer accessCount = container.invoke(bean, "readImmediately");
+ assertEquals(1, accessCount.intValue());
+
+ bean.getInstance().getSemaphore().release();
+
+ accessCount = future.get(5, SECONDS);
+ assertEquals(2, accessCount.intValue());
+ }
+
+ /**
+ * Can we invoke a method at all?
+ */
+ @Test
+ public void testSanity() throws Throwable
+ {
+ DirectContainer<SimpleBean> container = new DirectContainer<SimpleBean>("SimpleBean", "Singleton Container", SimpleBean.class);
+
+ BeanContext<SimpleBean> bean = container.construct();
+
+ String arg = new Date().toString();
+ String actual = container.invoke(bean, "sayHello", arg);
+
+ assertEquals("Hi " + arg, actual);
+ }
+
+ @Test
+ public void testWriteAfterRead() throws Throwable
+ {
+ ExecutorService executor = Executors.newCachedThreadPool();
+
+ final DirectContainer<SimpleBean> container = new DirectContainer<SimpleBean>("SimpleBean", "Singleton Container", SimpleBean.class);
+
+ final BeanContext<SimpleBean> bean = container.construct();
+
+ Callable<Integer> task = new ContainerInvocationTask<SimpleBean, Integer>(container, bean, "waitRead");
+ Future<Integer> future = executor.submit(task);
+ bean.getInstance().getBarrier().await(5, SECONDS);
+
+ Future<Integer> futureWrite = executor.submit(new ContainerInvocationTask<SimpleBean, Integer>(container, bean, "write"));
+
+ /* TODO: improve performance of the locking
+ // F I X M E: wait for the write to settle into the writeLock
+ Thread.sleep(1000);
+ int accessCount = container.invoke(bean, "readImmediately");
+ assertEquals(1, accessCount);
+ */
+
+ bean.getInstance().getSemaphore().release();
+
+ int accessCount = future.get(5, SECONDS);
+ assertEquals(1, accessCount);
+
+ accessCount = futureWrite.get(5, SECONDS);
+ assertEquals(2, accessCount);
+ }
+
+ @Test
+ public void testReadIntoRead() throws Throwable
+ {
+ DirectContainer<SimpleBean> container = new DirectContainer<SimpleBean>("SimpleBean", "Singleton Container", SimpleBean.class);
+
+ BeanContext<SimpleBean> bean = container.construct();
+
+ Integer accessCount = container.invoke(bean, "readInto", container, bean, "read");
+ assertEquals(1, accessCount.intValue());
+ }
+
+ @Test
+ public void testReadIntoWrite() throws Throwable
+ {
+ DirectContainer<SimpleBean> container = new DirectContainer<SimpleBean>("SimpleBean", "Singleton Container", SimpleBean.class);
+
+ BeanContext<SimpleBean> bean = container.construct();
+
+ try
+ {
+ container.invoke(bean, "readInto", container, bean, "write");
+ fail("Should have thrown " + IllegalLoopbackException.class.getSimpleName());
+ }
+ catch(IllegalLoopbackException e)
+ {
+ // good
+ }
+ }
+}
Added: projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/aop-deployers.xml
===================================================================
--- projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/aop-deployers.xml (rev 0)
+++ projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/aop-deployers.xml 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="AOPXMLMetaDataParserDeployer" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
+ <constructor>
+ <parameter>org.jboss.aop.microcontainer.beans.metadata.AOPDeployment</parameter>
+ </constructor>
+ <property name="suffix">-aop.xml</property>
+ </bean>
+ <bean name="AOPAnnotationMetaDataParserDeployer" class="org.jboss.aop.asintegration.jboss5.AOPAnnotationMetaDataParserDeployer">
+ <constructor>
+ <parameter><inject bean="AOPXMLMetaDataParserDeployer" property="relativeOrder"/></parameter>
+ </constructor>
+ </bean>
+ <bean name="AOPClassLoaderDeployer" class="org.jboss.aop.asintegration.jboss5.AOPClassLoaderDeployer">
+ <property name="aspectManager"><inject bean="AspectManager" property="aspectManager"/></property>
+ </bean>
+ <bean name="AOPDeploymentAopMetaDataDeployer" class="org.jboss.aop.asintegration.jboss5.AOPDeploymentAopMetaDataDeployer">
+ <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
+ <property name="aspectManager"><inject bean="AspectManager" property="aspectManager"/></property>
+ </bean>
+ <bean name="BeansDeploymentAopMetaDataDeployer" class="org.jboss.aop.asintegration.jboss5.BeansDeploymentAopMetaDataDeployer">
+ <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
+ <property name="aspectManager"><inject bean="AspectManager" property="aspectManager"/></property>
+ </bean>
+</deployment>
\ No newline at end of file
Added: projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/aop.xml
===================================================================
--- projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/aop.xml (rev 0)
+++ projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/aop.xml 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ AOP configuration
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <classloader><inject bean="aop-classloader:0.0.0"/></classloader>
+
+ <classloader name="aop-classloader" xmlns="urn:jboss:classloader:1.0" export-all="NON_EMPTY" import-all="true">
+ <!-- FIXME
+ <root>${jboss.lib.url}jboss-aop-asintegration-core.jar</root>
+ <root>${jboss.lib.url}jboss-aop-asintegration-jmx.jar</root>
+ <root>${jboss.lib.url}jboss-aop-asintegration-mc.jar</root>
+ <root>${jboss.lib.url}jboss-aop-jboss5.jar</root>
+ -->
+ </classloader>
+
+ <!-- Integration -->
+ <bean name="AOPJBossIntegration" class="org.jboss.aop.asintegration.jboss5.JBoss5Integration"/>
+
+ <bean name="DefaultAspectManager" class="org.jboss.aop.microcontainer.beans.metadata.DefaultAspectManager">
+ <property name="managerBean">AspectManager</property>
+ <property name="managerProperty">aspectManager</property>
+ </bean>
+
+
+ <!--
+ Valid values for the AspectManager bean for use with enableTransformer=true are:
+ * org.jboss.aop.deployers.AspectManagerJDK5 - works with the -javaagent:pluggable-instrumentor.jar switch
+ * org.jboss.aop.deployers.AspectManagerJRockit - works with JRockit and the -Xmanagement:class=org.jboss.aop.hook.JRockitPluggableClassPreProcessor switch
+ -->
+ <bean name="AspectManager" class="org.jboss.aop.deployers.AspectManagerJDK5">
+ <constructor>
+ <parameter><![CDATA[
+ <aop>
+ <aspect name="mainDeployer" class="org.jboss.profileservice.aop.MainDeployerAspect"/>
+ <bind pointcut="execution(* $instanceof{org.jboss.deployers.spi.deployment.MainDeployer}->process(..))">
+ <advice name="process" aspect="mainDeployer"/>
+ </bind>
+ <aspect name="persist" class="org.jboss.profileservice.aop.PersistAspect"/>
+ <bind pointcut="execution(* $instanceof{org.jboss.managed.api.ManagedProperty}->setValue(..))">
+ <advice name="setValue" aspect="persist"/>
+ </bind>
+ </aop>]]>
+ </parameter>
+ </constructor>
+
+ <property name="jbossIntegration"><inject bean="AOPJBossIntegration"/></property>
+
+ <property name="enableLoadtimeWeaving">false</property>
+ <!-- only relevant when EnableLoadtimeWeaving is true.
+ When transformer is on, every loaded class gets
+ transformed. If AOP can't find the class, then it
+ throws an exception. Sometimes, classes may not have
+ all the classes they reference. So, the Suppressing
+ is needed. (i.e. Jboss cache in the default configuration -->
+ <property name="suppressTransformationErrors">true</property>
+ <property name="prune">true</property>
+ <property name="include">org.jboss.test., org.jboss.injbossaop.</property>
+ <property name="exclude">org.jboss.</property>
+ <!-- This avoids instrumentation of hibernate cglib enhanced proxies
+ <property name="ignore">*$$EnhancerByCGLIB$$*</property> -->
+ <property name="optimized">true</property>
+ <property name="verbose">false</property>
+ <!--
+ Available choices for this attribute are:
+ org.jboss.aop.instrument.ClassicInstrumentor (default)
+ org.jboss.aop.instrument.GeneratedAdvisorInstrumentor
+ <property name="instrumentor">org.jboss.aop.instrument.ClassicInstrumentor</property>
+ -->
+ <!--
+ By default the deployment of the aspects contained in
+ ../deployers/jboss-aop-jboss5.deployer/base-aspects.xml
+ are not deployed. To turn on deployment uncomment this property
+ <property name="useBaseXml">true</property>
+ -->
+ </bean>
+
+</deployment>
Added: projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/classloader-deployers.xml
===================================================================
--- projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/classloader-deployers.xml (rev 0)
+++ projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/classloader-deployers.xml 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="ClassLoadingMetaDataParser" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
+ <constructor>
+ <parameter>org.jboss.classloading.spi.metadata.ClassLoadingMetaData</parameter>
+ </constructor>
+ <property name="name">jboss-classloading.xml</property>
+ <property name="buildManagedObject">true</property>
+ </bean>
+ <bean name="ClassLoadingDefaultDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer">
+ <property name="defaultMetaData">
+ <classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true"/>
+ </property>
+ </bean>
+ <bean name="InMemoryClassesDeployer" class="org.jboss.deployers.vfs.plugins.classloader.InMemoryClassesDeployer"/>
+ <bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer"/>
+ <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
+ <property name="classLoading"><inject bean="ClassLoading"/></property>
+ </bean>
+ <bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
+ <property name="classLoading"><inject bean="ClassLoading"/></property>
+ <property name="system"><inject bean="ClassLoaderSystem"/></property>
+ </bean>
+</deployment>
\ No newline at end of file
Added: projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/classloader.xml
===================================================================
--- projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/classloader.xml (rev 0)
+++ projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/classloader.xml 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ The core classloading system
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <classloader><inject bean="bootstrap-classloader:0.0.0"/></classloader>
+
+ <!--
+ The classloader implementation
+ -->
+ <bean name="ClassLoaderSystem" class="org.jboss.classloader.spi.ClassLoaderSystem">
+ <classloader><null/></classloader>
+ <constructor factoryClass="org.jboss.classloader.spi.ClassLoaderSystem" factoryMethod="getInstance"/>
+ </bean>
+
+ <!--
+ ClassLoader management and resolution
+ -->
+ <bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
+ <classloader><null/></classloader>
+ <incallback method="addModule" state="Configured"/>
+ <uncallback method="removeModule" state="Configured"/>
+ </bean>
+
+ <classloader name="bootstrap-classloader" xmlns="urn:jboss:classloader:1.0" export-all="NON_EMPTY" import-all="true">
+ <!-- System -->
+ <!-- FIXME
+ <root>${jboss.lib.url}jboss-system.jar</root>
+ -->
+ </classloader>
+
+</deployment>
Added: projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/jmx-jdk.xml
===================================================================
--- projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/jmx-jdk.xml (rev 0)
+++ projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/jmx-jdk.xml 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="MBeanServer" class="javax.management.MBeanServer">
+ <constructor factoryClass="javax.management.MBeanServerFactory" factoryMethod="newMBeanServer"/>
+ </bean>
+</deployment>
\ No newline at end of file
Added: projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/maindeployer.xml
===================================================================
--- projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/maindeployer.xml (rev 0)
+++ projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap/maindeployer.xml 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <classloader><inject bean="deployers-classloader:0.0.0"/></classloader>
+ <!-- bean name="SimpleClassLoaderDeployer" class="org.jboss.ejb3.timerservice.mk2.test.common.SimpleClassLoaderDeployer"/ -->
+
+ <classloader name="deployers-classloader" xmlns="urn:jboss:classloader:1.0" export-all="NON_EMPTY" import-all="true">
+ <!-- FIXME
+ <root>${jboss.lib.url}jboss-deployers-core-spi.jar</root>
+ <root>${jboss.lib.url}jboss-deployers-core.jar</root>
+ <root>${jboss.lib.url}jboss-deployers-client-spi.jar</root>
+ <root>${jboss.lib.url}jboss-deployers-client.jar</root>
+ <root>${jboss.lib.url}jboss-deployers-structure-spi.jar</root>
+ <root>${jboss.lib.url}jboss-deployers-spi.jar</root>
+ <root>${jboss.lib.url}jboss-deployers-impl.jar</root>
+ <root>${jboss.lib.url}jboss-deployers-vfs-spi.jar</root>
+ <root>${jboss.lib.url}jboss-deployers-vfs.jar</root>
+ -->
+ </classloader>
+
+ <!-- The MainDeployer -->
+ <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
+ <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
+ <property name="deployers"><inject bean="Deployers"/></property>
+ <!--property name="mgtDeploymentCreator"><inject bean="ManagedDeploymentCreator"/></property-->
+ </bean>
+
+ <!-- The holder for deployers that determine structure -->
+ <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
+ <property name="structureBuilder">
+ <!-- The consolidator of the structure information -->
+ <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder"/>
+ </property>
+ <!-- Accept any implementor of structure deployer -->
+ <incallback method="addDeployer"/>
+ <uncallback method="removeDeployer"/>
+ </bean>
+
+ <!-- The holder for deployers that do real deployment -->
+ <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
+ <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
+ <!-- Accept any implementor of deployer -->
+ <incallback method="addDeployer"/>
+ <uncallback method="removeDeployer"/>
+ </bean>
+
+ <!-- File Structure -->
+ <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure">
+ <constructor>
+ <parameter>
+ <set elementClass="java.lang.String">
+ <value>-aop.xml</value>
+ <value>-beans.xml</value>
+ </set>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <!-- File Structure -->
+ <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure"/>
+
+ <!-- POJO Deployment -->
+ <bean name="BeanDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanDeployer"/>
+ <bean name="KernelDeploymentDeployer" class="org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer"/>
+ <bean name="BeanMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer">
+ <constructor><parameter class="org.jboss.kernel.Kernel"><inject bean="jboss.kernel:service=Kernel"/></parameter></constructor>
+ </bean>
+</deployment>
Added: projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap.xml
===================================================================
--- projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap.xml (rev 0)
+++ projects/ejb3/trunk/concurrency/src/test/resources/conf/bootstrap.xml 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bootstrap xmlns="urn:jboss:bootstrap:1.0">
+<!--
+ <url>bootstrap/vfs.xml</url>
+ <url>bootstrap/classloader.xml</url>
+ <url>bootstrap/aop.xml</url>
+ <url>bootstrap/jmx.xml</url>
+ <url>bootstrap/deployers.xml</url>
+ <url>bootstrap/bindings.xml</url>
+ <url>bootstrap/profile-service.xml</url>
+-->
+ <url>bootstrap/classloader.xml</url>
+ <url>bootstrap/aop.xml</url>
+ <url>bootstrap/jmx-jdk.xml</url>
+ <url>bootstrap/maindeployer.xml</url>
+ <url>bootstrap/aop-deployers.xml</url>
+ <url>bootstrap/classloader-deployers.xml</url>
+</bootstrap>
Added: projects/ejb3/trunk/concurrency/src/test/resources/deploy/concurrency-aop.xml
===================================================================
--- projects/ejb3/trunk/concurrency/src/test/resources/deploy/concurrency-aop.xml (rev 0)
+++ projects/ejb3/trunk/concurrency/src/test/resources/deploy/concurrency-aop.xml 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<aop xmlns="urn:jboss:aop-beans:1.0">
+ <interceptor factory="org.jboss.ejb3.concurrency.ContainerManagedConcurrencyInterceptorFactory" scope="PER_INSTANCE"/>
+
+ <domain name="Singleton Container">
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.concurrency.ContainerManagedConcurrencyInterceptorFactory"/>
+ </bind>
+ </domain>
+</aop>
\ No newline at end of file
Added: projects/ejb3/trunk/concurrency/src/test/resources/log4j.xml
===================================================================
--- projects/ejb3/trunk/concurrency/src/test/resources/log4j.xml (rev 0)
+++ projects/ejb3/trunk/concurrency/src/test/resources/log4j.xml 2009-02-23 16:07:43 UTC (rev 84635)
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 68671 2008-01-08 10:04:25Z wolfc $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+ <param name="File" value="target/test.log"/>
+ <param name="Append" value="false"/>
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+ <!-- Rollover at the top of each hour
+ <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+ -->
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+
+ <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+ <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- A size based file rolling appender
+ <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+ <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
+ <param name="Append" value="false"/>
+ <param name="MaxFileSize" value="500KB"/>
+ <param name="MaxBackupIndex" value="1"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="ALL"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <!-- Limit JBoss categories to INFO
+ <category name="org.jboss">
+ <priority value="INFO" class="org.jboss.logging.XLevel"/>
+ </category>
+ -->
+
+ <!-- Increase the priority threshold for the DefaultDS category
+ <category name="DefaultDS">
+ <priority value="FATAL"/>
+ </category>
+ -->
+
+ <!-- Decrease the priority threshold for the org.jboss.varia category
+ <category name="org.jboss.varia">
+ <priority value="DEBUG"/>
+ </category>
+ -->
+
+ <!--
+ | An example of enabling the custom TRACE level priority that is used
+ | by the JBoss internals to diagnose low level details. This example
+ | turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
+ | subpackages. This will produce A LOT of logging output.
+ <category name="org.jboss.system">
+ <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+ </category>
+ -->
+
+ <category name="org.jboss">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <priority value="WARN" />
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
More information about the jboss-cvs-commits
mailing list