Java keyboard input parsing in a console app

后端 未结 2 603
梦如初夏
梦如初夏 2021-01-05 00:46

I\'ve just started messing around with JLine to parse character input in console mode. It seems to work well, but I\'m wondering:

Is there a nonblocking way in JLine

2条回答
  •  忘掉有多难
    2021-01-05 01:25

    You seem to be on the right track.

    I think the "right" way to do this is a worker thread that pours all the blocking I/O into a non-blocking queue. Hava a look at ConcurrentLinkedQueue from java.util.concurrent.

提交回复
热议问题