清单6展示了一个方法,该方法等待一个阻塞队列,直到队列中出现一个可用项目,而不管它是否被中断。
Listing 6 shows a method that waits on a blocking queue until an item is available, regardless of whether it is interrupted.
与传统的页面请求不同的是,调用不会中断用户体验,而浏览器在等待响应时也不会暂停。
Unlike a typical page request, the call doesn't interrupt the user experience, and the browser doesn't pause while waiting for the response.
在我们的例子中,这个测试应用程序应该派生一些线程,并等待(被阻塞)中断来触发这个线程。
In our example, the test application will spawn threads and wait (blocked) for interrupts to release the threads.
应用推荐