239
|
1 package jp.ac.u_ryukyu.treevnc;
|
|
2
|
|
3 import java.io.UnsupportedEncodingException;
|
|
4 import java.nio.ByteBuffer;
|
|
5 import java.util.LinkedList;
|
|
6
|
|
7 import com.glavsoft.rfb.encoding.EncodingType;
|
|
8
|
|
9
|
|
10 public class SendCheckDelay implements Runnable {
|
|
11
|
|
12 private TreeRFBProto rfb;
|
|
13
|
|
14 public SendCheckDelay(TreeRFBProto rfb) {
|
|
15 this.rfb = rfb;
|
|
16 }
|
|
17
|
|
18 public void sendCheckDelay() throws UnsupportedEncodingException {
|
|
19
|
|
20 LinkedList<ByteBuffer> checkdelay = new LinkedList<ByteBuffer>();
|
|
21 long time = System.currentTimeMillis();
|
|
22 checkdelay.add(new CheckDelay(0, 0, 0, 0, time, EncodingType.CHECK_DELAY).getMessage());
|
|
23 rfb.addSerialNumber(checkdelay);
|
|
24 rfb.multicastqueue.put(checkdelay);
|
|
25
|
|
26 }
|
|
27
|
|
28 public void run() {
|
|
29 for (;;) {
|
|
30 System.out.println("run sendCheckDelay");
|
|
31 long timeout = 50000 / 8;
|
|
32 try {
|
|
33 synchronized (this) {
|
|
34 wait(timeout);
|
|
35 sendCheckDelay();
|
|
36 }
|
|
37 } catch (InterruptedException e) {
|
|
38 e.printStackTrace();
|
|
39 } catch (UnsupportedEncodingException e) {
|
|
40 e.printStackTrace();
|
|
41 }
|
|
42 }
|
|
43 }
|
|
44
|
|
45 }
|