Once the message has been sent, the sender can store a reference to the Future object and check periodically for completion, or it can block and wait if needed by calling the get method.
消息被发送之后,发送者可以保存对Future对象的一个引用并定期检查是否完成,或者,它也可以通过调用get方法来阻塞和等待。
allows your thread to block - by calling f.get() - to ensure the network calls succeed, or go away by ignoring f altogether.
可以阻塞线程,再调用f.get()可以让网络调用继续进行或是忽略掉f。
If you need to block the calling thread for a specific time, then use the pthread_cond_timewait to block the thread.
如果您需要在指定的一段时间内阻塞发出调用的线程,那么请使用pthread_cond _timewait来阻塞它。
On the other hand, if the calling thread needs to be blocked for a specific time, then pthread_cond_timedwait is used to block the thread.
在另外一方面,如果调用线程需要被阻塞一段确定的时间,那么就可以使用pthread_cond _ timedwait来阻塞这个线程。
I suggest creating a method that logs exception information and calling that method in the catch block of your exception blocks.
我建议创建一个方法记录异常的信息,并且当出现异常时调用这个方法并遮蔽掉您所抛出的异常。
Why isn't calling wait(), notify() or notifyAll() without a synchronized block not a compiler error?
为什么不打电话给wait(),没有一个同步块不是一个编译错误notify()或notifyall()?
At Santorini beach, one small thing like a bottle of sun block will stop people calling you stupid.
在圣托里尼的海滩上,哪怕你只是记住了带上防晒油这一件小事,你就不会被人骂作傻瓜。
At Santorini beach, one small thing like a bottle of sun block will stop people calling you stupid.
在圣托里尼的海滩上,哪怕你只是记住了带上防晒油这一件小事,你就不会被人骂作傻瓜。
应用推荐