本文整理汇总了Java中org.apache.mina.core.session.IoSessionConfig.setReaderIdleTime方法的典型用法代码示例。如果您正苦于以下问题:Java IoSessionConfig.setReaderIdleTime方法的具体用法?Java IoSessionConfig.setReaderIdleTime怎么用?Java IoSessionConfig.setReaderIdleTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.mina.core.session.IoSessionConfig
的用法示例。
在下文中一共展示了IoSessionConfig.setReaderIdleTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serverStart
import org.apache.mina.core.session.IoSessionConfig; //导入方法依赖的package包/类
@Override
protected void serverStart() throws RemotingException {
acceptor = new NioSocketAcceptor(); //TCP Acceptor
// acceptor.getFilterChain().addFirst("logging", new MinaLoggingFilter());
acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new MinaCodecFactory(getCodec())));
acceptor.getFilterChain().addLast("mdc", new MdcInjectionFilter());
acceptor.setHandler(new MinaHandler(this));
IoSessionConfig cfg = acceptor.getSessionConfig();
cfg.setReaderIdleTime(remotingServerConfig.getReaderIdleTimeSeconds());
cfg.setWriterIdleTime(remotingServerConfig.getWriterIdleTimeSeconds());
cfg.setBothIdleTime(remotingServerConfig.getServerChannelMaxIdleTimeSeconds());
bindAddress = new InetSocketAddress(remotingServerConfig.getListenPort());
try {
acceptor.bind(bindAddress);
} catch (IOException e) {
throw new RemotingException("Start Mina server error", e);
}
}
示例2: clientStart
import org.apache.mina.core.session.IoSessionConfig; //导入方法依赖的package包/类
@Override
protected void clientStart() throws RemotingException {
try {
connector = new NioSocketConnector(); //TCP Connector
// connector.getFilterChain().addFirst("logging", new MinaLoggingFilter());
connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(new MinaCodecFactory(getCodec())));
connector.getFilterChain().addLast("mdc", new MdcInjectionFilter());
connector.setHandler(new MinaHandler(this));
IoSessionConfig cfg = connector.getSessionConfig();
cfg.setReaderIdleTime(remotingClientConfig.getReaderIdleTimeSeconds());
cfg.setWriterIdleTime(remotingClientConfig.getWriterIdleTimeSeconds());
cfg.setBothIdleTime(remotingClientConfig.getClientChannelMaxIdleTimeSeconds());
} catch (Exception e) {
throw new RemotingException("Mina Client start error", e);
}
}