Ferdinand Brunauer
Ferdinand Brunauer

Reputation: 371

Android - Netty - RejectedExecutionException

Im am back with a tricky question.

I have written a netty server for our Android Project but SOMETIMES, when i try to send something to the connected Clients, i get an RejectedExecutionException.

03-17 22:07:49.938 21708-22346/htlhallein.at.serverdatenbrille_rewritten E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-9824 Process: htlhallein.at.serverdatenbrille_rewritten, PID: 21708 java.util.concurrent.RejectedExecutionException: event executor terminated at io.netty.util.concurrent.SingleThreadEventExecutor.reject(SingleThreadEventExecutor.java:707) at io.netty.util.concurrent.SingleThreadEventExecutor.addTask(SingleThreadEventExecutor.java:299) at io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:690) at io.netty.channel.AbstractChannel$AbstractUnsafe.register(AbstractChannel.java:421) at io.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:60) at io.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:48) at io.netty.channel.MultithreadEventLoopGroup.register(MultithreadEventLoopGroup.java:64) at io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:315) at io.netty.bootstrap.AbstractBootstrap.doBind(AbstractBootstrap.java:271) at io.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:267) at io.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:242) at htlhallein.at.serverdatenbrille_rewritten.server.DatenbrillenServer$Server.run(DatenbrillenServer.java:172) at java.lang.Thread.run(Thread.java:841)

I am not sure which Event Executor i should take? The Exception gets fired a line after running the server. (Log.d(DatenbrillenServer.class.toString(), "Stopped Server ...");)

Did anyone have an Idea, why this happens ?

Thank you very much!

Upvotes: 2

Views: 2204

Answers (1)

Norman Maurer
Norman Maurer

Reputation: 23557

This happens when you try to do an IO after you called shutdownGracefully(). Be sure you are done with all IO before calling it

Upvotes: 2

Related Questions