Often, data access APIs such as JDBC and JPA provide only very generic information about the exceptioncondition, and do not allow the specific cause to be effectively identified.
Instead of throwing an exception when the queue is empty, the reader thread now blocks itself on the condition variable.
当队列是空的时候,读线程现在并不抛出异常,而是在条件变量上阻塞自身。
3
Exception handling is a programming language construct designed to handle the occurrence of some condition (exception) that changes the normal flow of execution.