1 package org.sapia.ubik.rmi.server.invocation; 2 3 import org.sapia.ubik.net.ServerAddress; 4 import org.sapia.ubik.rmi.server.*; 5 6 import java.io.Externalizable ; 7 import java.io.IOException ; 8 import java.io.ObjectInput ; 9 import java.io.ObjectOutput ; 10 11 12 22 public class CallBackInvokeCommand extends InvokeCommand 23 implements Externalizable { 24 static final long serialVersionUID = 1L; 25 private boolean _executed; 26 private String _respId; 27 private ServerAddress _callBackId; 28 29 32 public CallBackInvokeCommand() { 33 } 34 35 42 public CallBackInvokeCommand(OID oid, String methodName, Object [] params, 43 Class [] paramClasses, String transportType) { 44 super(oid, methodName, params, paramClasses, transportType); 45 } 46 47 50 public Object execute() throws Throwable { 51 if (!_executed) { 52 _executed = true; 53 54 if (Log.isDebug()) { 55 Log.debug(getClass(), "dispatching callback command " + _respId); 56 } 57 58 Hub.serverRuntime.processor.processAsyncCommand(_respId, _vmId, 59 _callBackId, this); 60 61 return new Integer (0); 62 } else { 63 if (Log.isDebug()) { 64 Log.debug(getClass(), "executing callback command " + _respId); 65 } 66 67 return super.execute(); 68 } 69 } 70 71 74 public void readExternal(ObjectInput in) 75 throws IOException , ClassNotFoundException { 76 super.readExternal(in); 77 _executed = in.readBoolean(); 78 _respId = (String ) in.readObject(); 79 _callBackId = (ServerAddress) in.readObject(); 80 } 81 82 85 public void writeExternal(ObjectOutput out) throws IOException { 86 super.writeExternal(out); 87 out.writeBoolean(_executed); 88 out.writeObject(_respId); 89 out.writeObject(_callBackId); 90 } 91 92 final void setUp(String respId, ServerAddress callBackId) { 93 _respId = respId; 94 _callBackId = callBackId; 95 } 96 } 97 | Popular Tags |