annotate src/fdl/FederatedLinda.java @ 23:b4fd7fb9135a

Simple Test run.
author kono
date Wed, 20 Aug 2008 03:28:45 +0900
parents 56e015e8f5dc
children 35375016b2f0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
1
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
2 /*
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
3 * @(#)FederatedLinda.java 1.1 06/04/01
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
4 *
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
5 * Copyright 2006 Shinji KONO
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
6 *
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
7
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
8 PSX Lidna
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
9 Trasport layer of PSX Linda library
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
10
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
11 */
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
12
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
13 package fdl;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
14
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
15 import java.io.IOException;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
16 import java.nio.ByteBuffer;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
17 import java.nio.ByteOrder;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
18 import java.nio.channels.ClosedSelectorException;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
19 import java.nio.channels.SelectionKey;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
20 import java.nio.channels.Selector;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
21 import java.nio.channels.SocketChannel;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
22 import java.util.Hashtable;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
23 import java.util.Set;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
24
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
25
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
26 /**
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
27 FederatedLinda
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
28 *
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
29 * @author Shinji Kono
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
30 *
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
31 * @param mytsid Tuple Space ID
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
32
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
33 Initialize connection channel for a tuple space
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
34
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
35 one instance for each Tuple space connection
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
36
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
37 */
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
38
17
609b288f47f9 *** empty log message ***
kono
parents: 15
diff changeset
39 public class FederatedLinda {
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
40
22
56e015e8f5dc Testing TestLindaServer
kono
parents: 21
diff changeset
41 static FederatedLinda fdl = new FederatedLinda();
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
42 static int MAX_SEQUENCE = 2048;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
43 static boolean debug = true;
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
44
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
45 public int tid;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
46 public int seq;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
47 public int qsize;
19
0243987383b7 Meta Protocol Engine and sample implementation of event logger.
kono
parents: 17
diff changeset
48 public PSXLindaInterface linda;
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
49
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
50 public Selector selector;
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
51
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
52 public PSXQueue q_top,q_end;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
53 public PSXReply r_top,r_end;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
54 public Hashtable<Integer,PSXReply> seqHash;
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
55
22
56e015e8f5dc Testing TestLindaServer
kono
parents: 21
diff changeset
56 public static FederatedLinda init() {
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
57 return fdl;
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
58 }
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
59
22
56e015e8f5dc Testing TestLindaServer
kono
parents: 21
diff changeset
60 private FederatedLinda() {
56e015e8f5dc Testing TestLindaServer
kono
parents: 21
diff changeset
61 try {
56e015e8f5dc Testing TestLindaServer
kono
parents: 21
diff changeset
62 selector = Selector.open();
56e015e8f5dc Testing TestLindaServer
kono
parents: 21
diff changeset
63 } catch (IOException e) {
56e015e8f5dc Testing TestLindaServer
kono
parents: 21
diff changeset
64 e.printStackTrace();
56e015e8f5dc Testing TestLindaServer
kono
parents: 21
diff changeset
65 }
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
66 seqHash = new Hashtable<Integer, PSXReply>();
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
67 }
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
68
19
0243987383b7 Meta Protocol Engine and sample implementation of event logger.
kono
parents: 17
diff changeset
69 public PSXLindaInterface open(String _host,int _port)
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
70 throws IOException {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
71 tid++;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
72 // System.out.print("Tid = ");
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
73 // System.out.println(tid);
19
0243987383b7 Meta Protocol Engine and sample implementation of event logger.
kono
parents: 17
diff changeset
74 PSXLindaInterface newlinda = new PSXLinda(this,tid,_host,_port);
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
75 linda = newlinda.add(linda);
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
76 return linda;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
77 }
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
78
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
79 /**
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
80 psx_queue (unsigned int tspace_id, unsigned int id,
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
81 unsigned int size, unsigned char *data, char mode,
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
82 void(*callback)(char*,void*), void * obj):
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
83 */
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
84
23
b4fd7fb9135a Simple Test run.
kono
parents: 22
diff changeset
85 public PSXReply psx_queue(PSXLinda linda, int id, ByteBuffer s, int mode, PSXCallback callback) {
b4fd7fb9135a Simple Test run.
kono
parents: 22
diff changeset
86 PSXQueue c = new PSXQueue(linda,id,mode,s,callback);
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
87
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
88 if (q_top == null) {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
89 c = q_end = q_top = c;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
90 } else {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
91 q_end.next = c;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
92 q_end = c;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
93 }
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
94 qsize++;
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
95
17
609b288f47f9 *** empty log message ***
kono
parents: 15
diff changeset
96 if (mode != PSX.PSX_OUT) {
609b288f47f9 *** empty log message ***
kono
parents: 15
diff changeset
97 PSXReply p = new PSXReply(PSX.PSX_REPLY,callback);
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
98 p.seq = seq(p);
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
99 c.setSeq(p.seq);
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
100 if (debug) {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
101 System.out.print("Integer compare=");
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
102 System.out.println((new Integer(2)).equals(new Integer(2)));
23
b4fd7fb9135a Simple Test run.
kono
parents: 22
diff changeset
103 System.out.print("Sedning seq=");
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
104 System.out.println(p.seq);
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
105 }
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
106 if (r_top == null){
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
107 r_end = r_top = p;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
108 } else {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
109 r_end.next = p;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
110 r_end = p;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
111 }
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
112 return p;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
113 }
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
114 return null;
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
115 }
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
116
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
117 public int seq(PSXReply reply) {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
118 Integer s;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
119 do {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
120 seq++;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
121 if (seq>MAX_SEQUENCE) {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
122 seq = 0;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
123 }
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
124 s = new Integer(seq);
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
125 } while (seqHash.containsKey(s));
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
126 if (debug) {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
127 System.out.print("hash value = ");
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
128 System.out.println(s.hashCode());
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
129 }
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
130 seqHash.put(s,reply);
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
131 seq++;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
132 return seq-1;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
133 }
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
134
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
135 public Selector selector() {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
136 return selector;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
137 }
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
138
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
139 public int sync() throws IOException {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
140 return sync(0);
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
141 }
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
142
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
143 public int sync(long mtimeout)
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
144 throws IOException {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
145 int key_num = 0;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
146 Set<SelectionKey> keys;
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
147
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
148 while (q_top != null){
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
149 PSXQueue c = q_top;
23
b4fd7fb9135a Simple Test run.
kono
parents: 22
diff changeset
150 c.send();
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
151 q_top = c.next;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
152 // psx_free(c);
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
153 // q_top = c = t;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
154 qsize--;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
155 }
2
b49e593b2502 Add ComDebug_Client
fuchita
parents: 0
diff changeset
156
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
157 try {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
158 key_num = selector.select(mtimeout);
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
159 keys = selector.selectedKeys();
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
160 for (SelectionKey key : keys) {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
161 // System.out.println("selecting");
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
162 SocketChannel sock = (SocketChannel)key.channel();
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
163 chkServe(sock);
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
164 }
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
165 } catch (IOException e) {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
166 e.printStackTrace();
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
167 } catch (ClosedSelectorException e) {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
168 e.printStackTrace();
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
169 }
2
b49e593b2502 Add ComDebug_Client
fuchita
parents: 0
diff changeset
170
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
171 return key_num;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
172 }
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
173
2
b49e593b2502 Add ComDebug_Client
fuchita
parents: 0
diff changeset
174 private void chkServe(SocketChannel sock)
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
175 throws IOException {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
176 int length;
17
609b288f47f9 *** empty log message ***
kono
parents: 15
diff changeset
177 ByteBuffer command = ByteBuffer.allocate(PSX.LINDA_HEADER_SIZE);
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
178 command.order(ByteOrder.BIG_ENDIAN);
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
179
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
180 sock.read(command);
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
181 command.rewind();
17
609b288f47f9 *** empty log message ***
kono
parents: 15
diff changeset
182 length = command.getInt(PSX.LINDA_DATA_LENGTH_OFFSET);
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
183 if (length>0) {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
184 ByteBuffer data = ByteBuffer.allocate(length);
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
185 int read = length;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
186 if (debug) {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
187 System.out.print("reading:");
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
188 System.out.println(length);
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
189 }
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
190
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
191 data.order(ByteOrder.BIG_ENDIAN);
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
192 while(read>0) {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
193 read -= sock.read(data);
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
194 }
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
195 data.rewind();
2
b49e593b2502 Add ComDebug_Client
fuchita
parents: 0
diff changeset
196
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
197 if (debug) {
17
609b288f47f9 *** empty log message ***
kono
parents: 15
diff changeset
198 PSX.printCommand(command, data);
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
199 }
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
200 /***if (debug) {
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
201 System.out.print("header:");
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
202 for(int i=0;i<LINDA_HEADER_SIZE;i++) {
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
203 System.out.println(command.get(i));
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
204 }
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
205 System.out.print("data:");
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
206 for(int i=0;i<length;i++) {
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
207 System.out.println(data.get(i));
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
208 }
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
209 data.rewind();
2
b49e593b2502 Add ComDebug_Client
fuchita
parents: 0
diff changeset
210 }***/
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
211
17
609b288f47f9 *** empty log message ***
kono
parents: 15
diff changeset
212 int rseq = command.getInt(PSX.LINDA_SEQ_OFFSET);
609b288f47f9 *** empty log message ***
kono
parents: 15
diff changeset
213 int mode = command.get(PSX.LINDA_MODE_OFFSET);
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
214 Integer a;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
215 /***
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
216 if (debug) {
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
217 System.out.print("mode = ");
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
218 System.out.println(mode);
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
219 System.out.print("seq = ");
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
220 System.out.println(rseq);
2
b49e593b2502 Add ComDebug_Client
fuchita
parents: 0
diff changeset
221 }***/
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
222 try {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
223 PSXReply r = seqHash.get((a = new Integer(rseq)));
19
0243987383b7 Meta Protocol Engine and sample implementation of event logger.
kono
parents: 17
diff changeset
224 seqHash.remove(a);
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
225 if (debug) {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
226 System.out.print("hash value = ");
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
227 System.out.println(a.hashCode());
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
228 }
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
229
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
230 r.setAnswer(mode,command,data);
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
231
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
232 if (r.callback != null ) {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
233 r.callback.callback(data);
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
234 }
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
235 } catch (NullPointerException e ) {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
236 if (debug) {
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
237 System.out.println("hashed reply not found");
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
238 }
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
239 // can't happen
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
240 return ;
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
241 }
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
242 }
11
1355eb28e41d fix seqHash removal on checkServe.
kono
parents: 2
diff changeset
243 }
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
244 }
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
245
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
246 /* end */