view src/fdl/test/transfer/cluster/TestGet.java @ 56:0143623aa465

(no commit message)
author axmo
date Wed, 11 Feb 2009 20:43:55 +0900
parents
children
line wrap: on
line source

package fdl.test.transfer.cluster;

import java.io.IOException;
import java.nio.ByteBuffer;

import fdl.FederatedLinda;
import fdl.PSXLinda;
import fdl.PSXReply;


public class TestGet extends Thread {
	private PSXLinda psxget;
	private FederatedLinda fdlget;
	private int port;
	String host = "127.0.0.1";
	private ByteBuffer data = ByteBuffer.allocate(1024);
	
	public TestGet(int port1) {
		this.port = port1;
	}
	
	public void run(){
		int id = 10;
		int i;
		fdlget = FederatedLinda.init();
		try {
			System.out.println("TestGet Start");
			psxget = fdlget.open(host, port);
			System.out.println("Host1 connected");
			//getにidのタプルを取り出す
			PSXReply dataGet = psxget.in(id);
			System.out.println("dataget");
			System.out.println(dataGet.ready());
			if(dataGet.ready()){
				System.out.println(dataGet);
				data = dataGet.getData();
				fdlget.sync(1);
				i = data.getInt();
				System.out.println(i);
			}
		} catch (IOException e) {
			try {
				Thread.sleep(10);
			} catch (InterruptedException e1) {
			}
		}
		}
}