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

elephant.rpc.network.netty.NettyChannel Maven / Gradle / Ivy

The newest version!
package elephant.rpc.network.netty;

import elephant.rpc.server.core.RPCChannel;
import io.netty.channel.Channel;

/**
 * 
 * @author skydu
 *
 */
public class NettyChannel implements RPCChannel{

	private Channel channel;
	
	public NettyChannel(Channel channel){
		this.channel=channel;
	}
	//
	@Override
	public void write(Object message) {
		channel.writeAndFlush(message);
	}
	
	@Override
	public boolean isConnected() {
		if(channel==null){
			return false;
		}
		return channel.isActive();
	}
	
	@Override
	public void disconnect() {
		if(channel==null){
			return;
		}
		channel.disconnect();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy