All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.craft.atom.nio.api.NioTcpConnectorBuilder Maven / Gradle / Ivy

There is a newer version: 3.1.2
Show newest version
package io.craft.atom.nio.api;

import io.craft.atom.io.IoConnector;
import io.craft.atom.io.IoHandler;
import io.craft.atom.nio.NioTcpConnector;


/**
 * Builder for {@link NioTcpConnector}
 * 
 * @author mindwind
 * @version 1.0, Mar 7, 2014
 */
public class NioTcpConnectorBuilder extends NioBuilder {


	private int connectTimeoutInMillis = 2000;
	
	
	public NioTcpConnectorBuilder(IoHandler handler) {
		super(handler);
	}
	
	
	public NioTcpConnectorBuilder connectTimeoutInMillis(int timeout) { this.connectTimeoutInMillis = timeout; return this; }
	
	
	public IoConnector build() {
		NioConnectorConfig config = new NioConnectorConfig();
		config.setConnectTimeoutInMillis(connectTimeoutInMillis);
		set(config);
		return new NioTcpConnector(handler, config, dispatcher, predictorFactory);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy