view src/alice/daemon/Connection.java @ 175:d7816b9b72e9 working

minor change
author e095732
date Thu, 24 Jan 2013 21:23:16 +0900
parents 3155337e754e
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();
	}

}