1 24 25 package activity; 26 27 import java.util.Map ; 28 29 import org.objectweb.dream.AbstractComponent; 30 import org.objectweb.dream.InterruptedPullException; 31 import org.objectweb.dream.Pull; 32 import org.objectweb.dream.PullException; 33 import org.objectweb.dream.message.Message; 34 import org.objectweb.dream.util.EmptyStringArray; 35 import org.objectweb.dream.util.Error; 36 import org.objectweb.fractal.api.NoSuchInterfaceException; 37 import org.objectweb.util.monolog.api.BasicLevel; 38 39 43 public class ServerImpl extends AbstractComponent implements Pull 44 { 45 46 boolean reentrant = false; 47 48 51 public Message pull(Map context) throws PullException 52 { 53 if (!reentrant) 54 { 55 reentrant = true; 56 Message m = null; 57 try 58 { 59 logger.log(BasicLevel.INFO, "reentrant call"); 60 m = ((Pull) weaveableC.getFcInterface(OUT_PULL_ITF_NAME)).pull(context); 61 } 62 catch (InterruptedPullException e) 63 { 64 logger.log(BasicLevel.INFO, "Wait interrupted 1"); 65 throw e; 66 } 67 catch (NoSuchInterfaceException e) 68 { 69 Error.bug(logger, e); 70 } 71 reentrant = false; 72 return m; 73 } 74 else 75 { 76 synchronized (this) 77 { 78 try 79 { 80 logger.log(BasicLevel.INFO, "Waitting"); 81 this.wait(); 82 logger.log(BasicLevel.INFO, "End of wait"); 83 } 84 catch (InterruptedException e) 85 { 86 logger.log(BasicLevel.INFO, "Wait interrupted 2"); 87 throw new InterruptedPullException(e); 88 } 89 return null; 90 } 91 } 92 } 93 94 97 public String [] listFc() 98 { 99 return EmptyStringArray.EMPTY_STRING_ARRAY; 100 } 101 102 } | Popular Tags |