1 25 26 package org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.basic; 27 28 import javax.ejb.Stateful ; 29 30 35 @Stateful  36 public class SFSBStressBean implements SFSBStressBeanRemote { 37 38 41 private static int value = 0; 42 43 46 private static final int SLEEP = 100; 47 48 49 52 public void initValue() { 53 value = 0; 54 } 55 56 60 public void testThreadSafe() { 61 value++; 62 try { 63 Thread.sleep(SLEEP); 64 } catch (InterruptedException e) { 65 e.printStackTrace(); 67 } 68 if (value > 1) { 69 throw new IllegalStateException ("Not thread safe"); 70 } 71 value--; 72 } 73 } 74 | Popular Tags |