KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfox > ioc > connector > ClusterInvocation


1 /*
2  * Copyright (c) 2005 Your Corporation. All Rights Reserved.
3  */

4
5 package org.jfox.ioc.connector;
6
7 import java.io.IOException JavaDoc;
8 import java.rmi.MarshalledObject JavaDoc;
9
10 import org.jfox.ioc.util.Marshaller;
11
12 /**
13  * 定义一个集群调用可能是一个创建或者复制对象的操作
14  *
15  * 该调用应该有 A5_InstancePoolHandler 发起
16  *
17  * @author <a HREF="mailto:young_yy@hotmail.com">Young Yang</a>
18  */

19
20 public class ClusterInvocation extends AbstractInvocation {
21
22     private transient Invocation invocation = null;
23     private ServerNode theNode = null;
24     private transient MarshalledObject JavaDoc 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 JavaDoc targetObject) {
40         throw new IllegalArgumentException JavaDoc("can not setTargetObject in ClusterInvocation.");
41     }
42
43     public ServerNode getClusterNode(){
44         return theNode;
45     }
46
47     private void writeObject(java.io.ObjectOutputStream JavaDoc out)
48             throws IOException JavaDoc {
49         out.defaultWriteObject();
50         out.writeObject(Marshaller.marshall(invocation));
51     }
52
53     private void readObject(java.io.ObjectInputStream JavaDoc in)
54             throws IOException JavaDoc, ClassNotFoundException JavaDoc {
55         in.defaultReadObject();
56         invocationMobj = (MarshalledObject JavaDoc)in.readObject();
57     }
58
59
60     public static void main(String JavaDoc[] args) {
61
62     }
63 }
64
Popular Tags