1 package org.objectweb.proactive.core.group; 2 3 import org.objectweb.proactive.Body; 4 import org.objectweb.proactive.core.body.LocalBodyStore; 5 import org.objectweb.proactive.core.body.proxy.UniversalBodyProxy; 6 import org.objectweb.proactive.core.mop.MethodCall; 7 import org.objectweb.proactive.core.mop.Proxy; 8 import org.objectweb.proactive.core.mop.StubObject; 9 10 import java.util.Vector ; 11 12 13 18 public class ProcessForAsyncCall extends AbstractProcessForGroup 19 implements Runnable { 20 21 private Vector memberListOfResultGroup; 22 private int index; 23 private MethodCall mc; 24 private Body body; 25 26 public ProcessForAsyncCall(ProxyForGroup proxyGroup, Vector memberList, 27 Vector memberListOfResultGroup, int index, MethodCall mc, Body body) { 28 this.proxyGroup = proxyGroup; 29 this.memberList = memberList; 30 this.memberListOfResultGroup = memberListOfResultGroup; 31 this.index = index; 32 this.mc = mc; 33 this.body = body; 34 } 35 36 public synchronized void run() { 37 Object object = this.memberList.get(this.index); 38 LocalBodyStore.getInstance().setCurrentThreadBody(body); 39 boolean objectIsLocal = false; 40 41 42 if (!(object instanceof Throwable )) { 43 Proxy lastProxy = AbstractProcessForGroup.findLastProxy(object); 44 if (lastProxy instanceof UniversalBodyProxy) { 45 objectIsLocal = ((UniversalBodyProxy) lastProxy).isLocal(); 46 } 47 try { 48 if (lastProxy == null) { 49 this.proxyGroup.addToListOfResult(memberListOfResultGroup, 51 this.mc.execute(object), this.index); 52 } else if (!objectIsLocal) { 53 54 55 this.proxyGroup.addToListOfResult(this.memberListOfResultGroup, 56 ((StubObject) object).getProxy().reify(this.mc), 57 this.index); 58 } else { 59 60 61 this.proxyGroup.addToListOfResult(this.memberListOfResultGroup, 62 ((StubObject) object).getProxy().reify(new MethodCall( 63 this.mc)), this.index); 64 } 65 } catch (Throwable e) { 66 67 68 this.proxyGroup.addToListOfResult(this.memberListOfResultGroup, 69 new ExceptionInGroup(this.memberList.get(this.index), e), 70 this.index); 71 } 72 } else { 73 74 75 this.proxyGroup.addToListOfResult(this.memberListOfResultGroup, 76 null, this.index); 77 } 78 } 79 } 80 | Popular Tags |