Close the core, if it is still in use waits until is no longer in use. @see #close() @see #isClosed()
()
| 1578 | } |
| 1579 | } |
| 1580 | |
| 1581 | /** |
| 1582 | * Close the core, if it is still in use waits until is no longer in use. |
| 1583 | * |
| 1584 | * @see #close() |
| 1585 | * @see #isClosed() |
| 1586 | */ |
| 1587 | public void closeAndWait() { |
| 1588 | close(); |
| 1589 | while (!isClosed()) { |
| 1590 | final long milliSleep = 100; |
| 1591 | if (log.isInfoEnabled()) { |
| 1592 | log.info( |
| 1593 | "Core {} is not yet closed, waiting {} ms before checking again.", |
| 1594 | getName(), |
| 1595 | milliSleep); |
| 1596 | } |
| 1597 | try { |
| 1598 | Thread.sleep(milliSleep); |
| 1599 | } catch (InterruptedException e) { |
| 1600 | Thread.currentThread().interrupt(); |
| 1601 | throw new SolrException( |
| 1602 | ErrorCode.SERVER_ERROR, |
| 1603 | "Caught InterruptedException whilst waiting for core " |
| 1604 | + getName() |
| 1605 | + " to close: " |
| 1606 | + e.getMessage(), |
no test coverage detected