view src/alice/daemon/Connection.java @ 39:3155337e754e

add logger
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Fri, 27 Jan 2012 16:57:26 +0900
parents 54bf607118ae
children 2a8bcf09bd06
line wrap: on
line source

package alice.daemon;

import java.net.Socket;
import java.util.concurrent.LinkedBlockingQueue;

import alice.datasegment.Command;

public class Connection {

	public Socket socket;
	public LinkedBlockingQueue<Command> sendQueue = new LinkedBlockingQueue<Command>();
	
	public Connection(Socket socket) {
		this.socket = socket;
	}
	
	public Connection() { }

	public void sendCommand(Command cmd) {
		try {
			sendQueue.put(cmd);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
	
	public String getInfoString() {
		return socket.getInetAddress().getHostName()
			   + ":" + socket.getPort();
	}

}