This is an automated email from the ASF dual-hosted git repository.
elecharny pushed a commit to branch 2.2.X
in repository https://gitbox.apache.org/repos/asf/mina.git
The following commit(s) were added to refs/heads/2.2.X by this push:
new c7cb73cb4 Added a missing changed for DIRMINA-1169
c7cb73cb4 is described below
commit c7cb73cb45e81d482b2ac6a63a3ac777ae79051f
Author: emmanuel lecharny <[email protected]>
AuthorDate: Sat May 20 23:13:24 2023 +0200
Added a missing changed for DIRMINA-1169
---
.../transport/socket/nio/NioSocketAcceptor.java | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git
a/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketAcceptor.java
b/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketAcceptor.java
index 89253232e..cfbaea239 100644
---
a/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketAcceptor.java
+++
b/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketAcceptor.java
@@ -134,6 +134,35 @@ implements SocketAcceptor {
selector = selectorProvider.openSelector();
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void handleUnbound(Collection<AcceptorOperationFuture>
unboundFutures) throws Exception {
+ // If we're on Java >= 11, unbindings may take effect only on the next
select()
+ // TODO: add a check (java.specification.version?) to do this only on
a JVM >= 11?
+ if (!unboundFutures.isEmpty()) {
+ int selected = 0;
+ try {
+ // Simply select() would also work since wakeup() *was*
called, but let's be explicit.
+ selected = selector.selectNow();
+ } finally {
+ super.handleUnbound(unboundFutures); // Marks the futures as
done
+ if (hasUnbindings()) {
+ // Depending on when these new unbindings were added,
their wakeup() call may just have been
+ // cancelled by the above select. Re-instate it, so that
the next select will not block, as
+ // expected.
+ wakeup();
+ }
+ }
+ if (selected > 0) {
+ processHandles(selectedHandles());
+ }
+ } else {
+ super.handleUnbound(unboundFutures);
+ }
+ }
/**
* {@inheritDoc}