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

com.generallycloud.baseio.component.WriteCompletionHandler Maven / Gradle / Ivy

package com.generallycloud.baseio.component;

import java.nio.channels.CompletionHandler;

import com.generallycloud.baseio.common.CloseUtil;
import com.generallycloud.baseio.common.Logger;
import com.generallycloud.baseio.common.LoggerFactory;

public class WriteCompletionHandler implements CompletionHandler{

	private Logger logger = LoggerFactory.getLogger(getClass());

	@Override
	public void completed(Integer result, AioSocketChannel channel) {
		
		channel.writeCallback(result);
	}

	@Override
	public void failed(Throwable exc, AioSocketChannel channel) {
		
		logger.error(exc.getMessage() + " channel:" + channel, exc);

		CloseUtil.close(channel);
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy