promise VS future

Future and Promise are the two separate sides of an asynchronous operation.

promise is used by the "producer/writer" of the asynchronous operation.

future is used by the "consumer/reader" of the asynchronous operation.

1.

GenericFutureListener.operationComplete(Future) is directly called by an I/O thread. Therefore, performing a time consuming task or a

blocking operation in the handler method can cause an unexpected pause during I/O. If you need to perform a blocking operation on I/O completion,

try to execute the operation in a different thread using a thread pool.

原文地址:https://www.cnblogs.com/yuyutianxia/p/7252030.html