當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。