http://svn.apache.org/viewvc/river/jtsk/trunk/src/com/sun/jini/jeri/internal/mux/Mux.java?r1=1069292&r2=1135026&diff_format=h
ここで、タイムアウトが最近追加されたことがわかります
startTimeout が 0 より大きいことを確認してください。それ以外の場合は、wait(0) または wait(-n) になります。これにより、IllegalMonitorStateException が発生する可能性があります。
編集:上記は災害ですが、これを試してみましょう:
Mux コンストラクターにいます: http://svn.apache.org/viewvc/river/jtsk/trunk/src/com/sun/jini/jeri/internal/mux/Mux.java?view=markup
176 行目で SocketChannelConnectionIO を作成し、これを渡します。その後、ブレークし、別のスレッドが引き継ぎます。
ここで定義されている SocketChannelConnectionIO のコンストラクター: http://svn.apache.org/viewvc/river/jtsk/trunk/src/com/sun/jini/jeri/internal/mux/SocketChannelConnectionIO.java?view=markup
行 112 を登録します。 new handler() でチャネリングします。
ハンドラーはシャネルで何かを受け取り、関数は、関数 handleReadReady が実行され、 muxLock で同期するとします。
今はまだコンストラクターにいるので、ファイナルのオブジェクトはまだ変更可能です!!! それが変更されたと仮定しましょう。今、別のmuxLockで何かを待っています
100万分の1のシナリオ
編集
http://svn.apache.org/viewvc/river/jtsk/trunk/src/com/sun/jini/jeri/internal/mux/Mux.java?revision=1135026&view=co
Mux(SocketChannel channel,
int role, int initialInboundRation, int maxFragmentSize)
throws IOException
{
this.role = role;
if ((initialInboundRation & ~0x00FFFF00) != 0) {
throw new IllegalArgumentException(
"illegal initial inbound ration: " +
toHexString(initialInboundRation));
}
this.initialInboundRation = initialInboundRation;
this.maxFragmentSize = maxFragmentSize;
//LINE BELOW IS CAUSING PROBLEM it passes this to SocketChannelConnectionIO
this.connectionIO = new SocketChannelConnectionIO(this, channel);
//Lets assume it stops here we are still in constructor
//and we are not in synchronized block
directBuffersUseful = true;
}
現在、SocketChannelConnectionIO
http://svn.apache.org/viewvc/river/jtsk/trunk/src/com/sun/jini/jeri/internal/mux/SocketChannelConnectionIO.java?revision=1069292&view=coのコンストラクタにあります。
SocketChannelConnectionIO(Mux mux, SocketChannel channel)
throws IOException
{
super(mux);
channel.configureBlocking(false);
this.channel = channel;
//Line below we are registering to the channel with mux that is still mutable
//this is the line that actually is causing the problem move that to
// start() and it should work
key = selectionManager.register(channel, new Handler());
}
このコードを start() に移動すると動作するはずkey = selectionManager.register(channel, new Handler());
です (処理を開始したい場合は start が executet であると想定しています)
/**
* Starts processing connection data.
*/
void start() throws IOException {
key = selectionManager.register(channel, new Handler());
key.renewInterestMask(SelectionKey.OP_READ);
}
ただし、mux のコンストラクターで SocketChannelConnectionIO を作成しない方がはるかに良いでしょうが、その後のどこかで、これで StreamConnectionIO を作成する 2 番目のコンストラクターと同じになる可能性があります。