1 4 5 package org.jfox.ioc.connector; 6 7 import java.io.IOException ; 8 import java.rmi.MarshalledObject ; 9 10 import org.jfox.ioc.util.Marshaller; 11 12 19 20 public class ClusterInvocation extends AbstractInvocation { 21 22 private transient Invocation invocation = null; 23 private ServerNode theNode = null; 24 private transient MarshalledObject invocationMobj = null; 25 26 public ClusterInvocation(Invocation invocation, ServerNode sourceNode) { 27 super(invocation.getObjectId(),invocation.getMethodHash(), invocation.getArgs()); 28 this.invocation = invocation; 29 theNode = sourceNode; 30 } 31 32 public synchronized Invocation getInvocation(){ 33 if(invocation == null){ 34 invocation = (Invocation)Marshaller.unmarshall(invocationMobj); 35 } 36 return invocation; 37 } 38 39 public void setTargetObject(Object targetObject) { 40 throw new IllegalArgumentException ("can not setTargetObject in ClusterInvocation."); 41 } 42 43 public ServerNode getClusterNode(){ 44 return theNode; 45 } 46 47 private void writeObject(java.io.ObjectOutputStream out) 48 throws IOException { 49 out.defaultWriteObject(); 50 out.writeObject(Marshaller.marshall(invocation)); 51 } 52 53 private void readObject(java.io.ObjectInputStream in) 54 throws IOException , ClassNotFoundException { 55 in.defaultReadObject(); 56 invocationMobj = (MarshalledObject )in.readObject(); 57 } 58 59 60 public static void main(String [] args) { 61 62 } 63 } 64 | Popular Tags |