当前位置: 首页>>代码示例>>Java>>正文


Java SelectableChannel.configureBlocking方法代码示例

本文整理汇总了Java中java.nio.channels.SelectableChannel.configureBlocking方法的典型用法代码示例。如果您正苦于以下问题:Java SelectableChannel.configureBlocking方法的具体用法?Java SelectableChannel.configureBlocking怎么用?Java SelectableChannel.configureBlocking使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.nio.channels.SelectableChannel的用法示例。


在下文中一共展示了SelectableChannel.configureBlocking方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: register

import java.nio.channels.SelectableChannel; //导入方法依赖的package包/类
private void register(SelectableChannel channel, int ops, Handler callback) {
    try {
        channel.configureBlocking(false);
        /*SelectionKey serverKey =*/ channel.register(selector, ops, callback);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:9,代码来源:NIOEventLoop.java

示例2: SocketIOWithTimeout

import java.nio.channels.SelectableChannel; //导入方法依赖的package包/类
SocketIOWithTimeout(SelectableChannel channel, long timeout) 
                                               throws IOException {
  checkChannelValidity(channel);
  
  this.channel = channel;
  this.timeout = timeout;
  // Set non-blocking
  channel.configureBlocking(false);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:10,代码来源:SocketIOWithTimeout.java

示例3: registerChannel

import java.nio.channels.SelectableChannel; //导入方法依赖的package包/类
/**
 * Register the given channel with the given selector for
 * the given operations of interest
 */
protected void registerChannel(Selector selector,
                               SelectableChannel channel,
                               int ops,
                               Object attach) throws Exception {
    if (channel == null)return; // could happen
    // set the new channel non-blocking
    channel.configureBlocking(false);
    // register it with the selector
    channel.register(selector, ops, attach);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:15,代码来源:NioReceiver.java

示例4: makeBlocking

import java.nio.channels.SelectableChannel; //导入方法依赖的package包/类
/**
 * Switch this guy to blocking mode so we can use oldIO to read and write msgs.
 */
public void makeBlocking() throws IOException {
  // logger.info("DEBUG: makeBlocking " + this);

  // if (this.sKey != null) {
  // this.sKey = null;
  // }
  SelectableChannel c = this.theSocket.getChannel();
  c.configureBlocking(true);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:13,代码来源:ServerConnection.java

示例5: registerChannel

import java.nio.channels.SelectableChannel; //导入方法依赖的package包/类
/**
 * Register the given channel with the given selector for the given
 * operations of interest
 */
protected void registerChannel(Selector selector, SelectableChannel channel, int ops, Object attach)
		throws Exception {
	if (channel == null)
		return; // could happen
	// set the new channel non-blocking
	channel.configureBlocking(false);
	// register it with the selector
	channel.register(selector, ops, attach);
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:14,代码来源:NioReceiver.java

示例6: init

import java.nio.channels.SelectableChannel; //导入方法依赖的package包/类
@Override
protected void init(NioSession session) throws Exception {
    SelectableChannel ch = (SelectableChannel) session.getChannel();
    ch.configureBlocking(false);
    session.setSelectionKey(ch.register(selector, SelectionKey.OP_READ, session));
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:7,代码来源:NioProcessor.java


注:本文中的java.nio.channels.SelectableChannel.configureBlocking方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。