package org.jboss.as.test.integration.ee.appclient.basic;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import javax.ejb.ConcurrencyManagement;
import javax.ejb.ConcurrencyManagementType;
import javax.ejb.Singleton;

/**
 * @author Stuart Douglas
 */
@Singleton
@ConcurrencyManagement(ConcurrencyManagementType.BEAN)
public class AppClientStateSingleton implements AppClientSingletonRemote {

    private volatile CountDownLatch latch = new CountDownLatch(1);

    private volatile String value;

    @Override
    public void reset() {
        value = null;
        //if we have a thread blocked on the latch release it
        latch.countDown();
        latch = new CountDownLatch(1);
    }

    @Override
    public void makeAppClientCall(final String value) {
        this.value = value;
        latch.countDown();
    }

    @Override
    public String awaitAppClientCall() {
        try {
            latch.await(10, TimeUnit.SECONDS);
            return value;
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}

@@ -248,16 +248,50 @@
 leton;%0A%0A
+import org.jboss.logging.Logger;%0A%0A
 /**%0A * @
@@ -456,16 +456,106 @@
 Remote %7B
+%0A    private static final Logger logger = Logger.getLogger(%22org.jboss.as.test.appclient%22);
 %0A%0A    pr
@@ -688,24 +688,62 @@
 d reset() %7B%0A
+        logger.info(%22Reset called!%22);%0A
         valu
@@ -953,24 +953,71 @@
 ng value) %7B%0A
+        logger.info(%22AppClient Call called!%22);%0A
         this
@@ -1142,24 +1142,36 @@
 %0A           
+ boolean b =
  latch.await
@@ -1194,16 +1194,81 @@
 CONDS);%0A
+            logger.info(%22Await returned: %22 + b + %22 : %22 + value);%0A
         

Add some temporary debug logging to figure out test failures