It encapsulates a request (a method call on some object) as an object, which lets you parameterise clients with different requests, queue or log requests, and support un-doable operations.
它将请求(某个对象上的方法调用)作为对象封装,这使您能够通过不同的请求(队列或日志请求)确定客户机的参数并支持无法执行的操作。
The thread will in fact attempt another remove call on the queue and will become blocked until the next available request.
事实上,线程会对队列尝试另一个remove调用,并变成阻塞,直到下一个请求可用。
If you wanted the queued item to do something else, you would need to add that to the implementation of the Delayed object and call that new method upon retrieval from the queue.
如果希望队列项做一些其他事情,就需要在Delayed对象的实现中加入方法,并在从队列中取出后调用这个新方法。
应用推荐