LoginSignup
2
0

More than 5 years have passed since last update.

Jython で java.util.concurrent.RejectedExecutionException: event executor terminated が出る場合の対処法

Posted at

Jythonインタープリタで繰り返し urllib2 を使う処理をしようとするとこの例外が発生する。
Jython は内部実装で netty を使っているが、ソケットを閉じた後再度開かずにこけるらしい。

いろいろググったけどなかなか有益な情報にたどり着けなかったけれど、苦労して発見したので記録。

Krzysztof Guć (krzysiek-q) wrote on 2016-12-27: #5
Hi All.

Hi Guys, J found Solution:

try add something that in header:

import sys, _socket
if _socket.NIO_GROUP.isShutdown():
    print "RE-CREATEING NIO_GROUP"
    _socket.NIO_GROUP = _socket.NioEventLoopGroup(2, _socket.DaemonThreadFactory("PyScan-Netty-Client-%s"))
    sys.registerCloser(_socket._shutdown_threadpool)

これで解決しました。
名前は読めないけど、ありがとう!

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0