1 31 package org.objectweb.proactive.core.body.request; 32 33 import org.apache.log4j.Logger; 34 35 import org.objectweb.proactive.Body; 36 37 38 public class RequestReceiverImpl implements RequestReceiver, 39 java.io.Serializable { 40 public static Logger logger = Logger.getLogger(RequestReceiverImpl.class.getName()); 41 42 private java.util.Vector immediateServices; 44 45 public RequestReceiverImpl() { 46 this.immediateServices = new java.util.Vector (2); 47 this.immediateServices.add("toString"); 48 this.immediateServices.add("hashCode"); 49 } 50 51 public void receiveRequest(Request request, Body bodyReceiver) 52 throws java.io.IOException { 53 if (immediateExecution(request.getMethodName())) { 54 if (logger.isDebugEnabled()) { 55 logger.debug("immediately serving " + request.getMethodName()); 56 } 57 bodyReceiver.serve(request); 58 if (logger.isDebugEnabled()) { 59 logger.debug("end of service for " + request.getMethodName()); 60 } 61 } else { 62 request.notifyReception(bodyReceiver); 63 bodyReceiver.getRequestQueue().add(request); 64 } 65 } 66 67 private boolean immediateExecution(String methodName) { 68 if (logger.isDebugEnabled()) { 69 logger.debug("immediateExecution for methode " + methodName + 70 " is " + immediateServices.contains(methodName)); 71 } 72 73 return immediateServices.contains(methodName); 79 } 80 81 public void setImmediateService(String methodName) { 82 this.immediateServices.add(methodName); 83 } 84 } 85 | Popular Tags |