tkroman
tkroman

Reputation: 4798

How to set arbitrary delay between request and response in Netty?

I'm implementing a primitive http server and I have a handler extending SimpleChannelInboundHandler. I have a method that's processing requests and I want to make a delay after processing specific request. How should I implement the pause so that server's behaviour still conforms to standards? I mean, client (browser etc.) should not behave like connection is lost or something like that, but just wait till the necessary amount of time passes.

Upvotes: 0

Views: 924

Answers (1)

Norman Maurer
Norman Maurer

Reputation: 23557

You could just use:

ctx.executor().schedule(...)

This way you could do the write in the Runnable you pass to the schedule call.

Upvotes: 1

Related Questions