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

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

package fdl.test.transfer.cluster;

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

import fdl.FederatedLinda;
import fdl.PSXLinda;

public class TestSend extends Thread {
	PSXLinda psxsend;
	FederatedLinda fdlsend;
	private int port;
	
	public TestSend(int port1) {
		this.port = port1;
	}

	public void run(){
		int id = 10;
		int i;
		String host = "127.0.0.1";
		ByteBuffer send = ByteBuffer.allocate(1024);
		send.putInt(12);
		send.flip();
		i = send.getInt();
		send.rewind();
		fdlsend = FederatedLinda.init();
		boolean connect = true;
		while(connect) {
		try{
			System.out.println("TestSend Start");
			psxsend = fdlsend.open(host,port);
			System.out.println("Set Data = " +i);
			System.out.println("Connect Host1");
			psxsend.out(id, send);
			System.out.println("regist Que");
			fdlsend.sync(1);
			System.out.println("Send Data");
			connect = false;
		}catch (IOException e) {
			try {
				Thread.sleep(40);
			} catch (InterruptedException e1) {
			}
		}
		}
	}

	
}