AMashenkov commented on a change in pull request #395:
URL: https://github.com/apache/ignite-3/pull/395#discussion_r728071512
##########
File path:
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlQueryProcessor.java
##########
@@ -96,15 +89,39 @@ public SqlQueryProcessor(
tableManager.listen(TableEvent.DROP, new
TableDroppedListener(schemaHolder));
}
-
/** {@inheritDoc} */
- @Override public void stop() throws NodeStoppingException {
- // TODO: IGNITE-15161 Implement component's stop.
+ @Override public void stop() throws Exception {
+ busyLock.block();
+
+ Exception exOut = null;
+
+ for (AutoCloseable service : new AutoCloseable[] {executionSrvc,
msgSrvc, taskExecutor}) {
+ try {
+ service.close();
+ }
+ catch (Exception ex) {
+ if (exOut == null)
+ exOut = ex;
+ else
+ exOut.addSuppressed(ex);
+ }
+ }
+
+ if (exOut != null)
+ throw exOut;
}
/** {@inheritDoc} */
@Override public List<SqlCursor<List<?>>> query(String schemaName, String
qry, Object... params) {
- return executionSrvc.executeQuery(schemaName, qry, params);
+ if (!busyLock.enterBusy())
+ throw new IgniteException(new NodeStoppingException("Operation has
been cancelled (node is stopping)."));
Review comment:
Maybe this message could be a default one? WDYT?
I can't imagine a case when NodeStoppingException will be initialized with
any other message.
##########
File path:
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/MailboxRegistryImpl.java
##########
@@ -126,6 +126,12 @@ private void onNodeLeft(ClusterNode node) {
return S.toString(MailboxRegistryImpl.class, this);
}
+ /** {@inheritDoc} */
+ @Override public void close() throws Exception {
Review comment:
```suggestion
@Override public void close() {
```
##########
File path:
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageServiceImpl.java
##########
@@ -148,4 +148,8 @@ private void onMessageInternal(String nodeId,
NetworkMessage msg) {
lsnr.onMessage(nodeId, msg);
}
+
+ @Override public void close() throws Exception {
Review comment:
```suggestion
@Override public void close() {
```
##########
File path:
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlQueryProcessor.java
##########
@@ -96,15 +89,39 @@ public SqlQueryProcessor(
tableManager.listen(TableEvent.DROP, new
TableDroppedListener(schemaHolder));
}
-
/** {@inheritDoc} */
- @Override public void stop() throws NodeStoppingException {
- // TODO: IGNITE-15161 Implement component's stop.
+ @Override public void stop() throws Exception {
+ busyLock.block();
+
+ Exception exOut = null;
+
+ for (AutoCloseable service : new AutoCloseable[] {executionSrvc,
msgSrvc, taskExecutor}) {
Review comment:
Can IgniteUtils.closeAll() be reused here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]