九州場所の千秋楽。
これより三役そろい踏み、と、東西の三役(計六人)が出てきて、日本人は二人だけで、こいつら互助会なんだろうなー、と思っていたらほんとうに電撃のごとくスピードで互助しやがった。小手投げしてください、と、手を出したミツキに、よっしゃ任せとけ、と小手投げをする魁皇。こいつら型の演舞と勘違いしてるんじゃないのか?もはや様式美の世界である。実況の北の富士勝昭すらコメントがしょっぱくなる。本当の相撲の面白さは、その様式美の後、外国人力士によってのみ表現される。やはり、白鵬とやるときの朝青龍は凄まじくガチで、見応えがありすぎて目のやり場に困る。ミツキにしても白鵬とあたったときは全精力を注ぐような凄まじい取り組みを見せている訳で、そう考えるとつまらなくしているのは魁皇君?と言いたくなる。
メモ
javaのnioを使ったechoサーバの実装例
import java.nio.*; import java.net.*; import java.io.*; import javax.xml.crypto.*; import java.nio.channels.*; import java.util.*; public class NIOEchoServer implements Runnable { public static final int TIMEOUT= 5*1000; public static final int BUFFERSIZE = 8192; private ServerSocketChannel serverChannel; public NIOEchoServer(int port) throws IOException { this.serverChannel = ServerSocketChannel.open(); serverChannel.configureBlocking(false); serverChannel.socket().bind (new InetSocketAddress(port)); } // Runnable run method public void run() { try{ Selector selector = Selector.open(); serverChannel.register(selector, serverChannel.validOps()); // 登録したチャネルがある間ループする while (selector.keys().size() > 0){ int keyCount = selector.select(TIMEOUT); Iterator selectedKeysIterator = selector.selectedKeys().iterator(); // セレクトされたキーをループする while (selectedKeysIterator.hasNext()){ SelectionKey key = (SelectionKey)selectedKeysIterator.next(); // セレクトされたキーの酒豪から削除して有効性をチェックする selectedKeysIterator.remove(); if(!key.isValid()) continue; // 各処理を発進する if(key.isAcceptable()) handleAceptable(key); if(key.isReadable()) handleReadable(key); if(key.isWritable()) handleWritable(key); } } }catch(IOException e){ e.printStackTrace(); // ここの例外は潰す(実際には実装が必要) } } //acceptできるキーを扱う void handleAceptable(SelectionKey key) { try{ ServerSocketChannel srvCh = (ServerSocketChannel)key.channel(); SocketChannel channel = srvCh.accept(); channel.configureBlocking(false); //会話にバッファを割り当てる ByteBuffer buffer = ByteBuffer.allocateDirect(BUFFERSIZE); // acceptしたチャネルをreadで登録する // バッファをアタッチメントにする channel.register(key.selector(), SelectionKey.OP_READ, buffer); }catch(IOException e){ e.printStackTrace(); } } void handleReadable(SelectionKey key) { try{ SocketChannel channel = (SocketChannel)key.channel(); ByteBuffer buffer = (ByteBuffer)key.attachment(); int count = channel.read(buffer); // 入力を出力へエコーする // ライト可を想定する handleWritable(key); if(count < 0){ // EOF - 出力の残りをフラッシュしてクローズする while(buffer.position() > 0){ buffer.flip(); channel.write(buffer); buffer.compact(); } key.cancel(); channel.close(); } }catch(IOException e){ e.printStackTrace(); } // } // writeできるキーを扱う void handleWritable(SelectionKey key) { try{ SocketChannel channel = (SocketChannel)key.channel(); ByteBuffer buffer = (ByteBuffer)key.attachment(); buffer.flip(); int count = channel.write(buffer); buffer.compact(); // ライト操作の正否に基づいて // OP_WRITEで登録するかまたは登録を取り消す int ops = key.interestOps(); if(buffer.hasRemaining()) ops |= SelectionKey.OP_WRITE; else ops |= ~SelectionKey.OP_WRITE; key.interestOps(ops); }catch(IOException e){ e.printStackTrace(); } } }