Skip to content

Commit 04f999d

Browse files
committed
Merge remote-tracking branch 'origin/trunk' into kloczek/trunk
Signed-off-by: Viet Nguyen Duc <[email protected]>
2 parents b92b884 + 9af4e15 commit 04f999d

File tree

6 files changed

+17
-10
lines changed

6 files changed

+17
-10
lines changed

java/src/org/openqa/selenium/concurrent/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ java_library(
44
name = "concurrent",
55
srcs = glob(["*.java"]),
66
visibility = [
7+
"//java/src/org/openqa/selenium/events:__subpackages__",
78
"//java/src/org/openqa/selenium/grid:__subpackages__",
89
"//java/src/org/openqa/selenium/remote:__subpackages__",
910
],

java/src/org/openqa/selenium/events/zeromq/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ java_library(
1212
],
1313
deps = [
1414
"//java/src/org/openqa/selenium:core",
15+
"//java/src/org/openqa/selenium/concurrent",
1516
"//java/src/org/openqa/selenium/events",
1617
"//java/src/org/openqa/selenium/grid/config",
1718
"//java/src/org/openqa/selenium/grid/security",

java/src/org/openqa/selenium/events/zeromq/UnboundZmqEventBus.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import java.util.function.Consumer;
4343
import java.util.logging.Level;
4444
import java.util.logging.Logger;
45+
import org.openqa.selenium.concurrent.ExecutorServices;
4546
import org.openqa.selenium.events.Event;
4647
import org.openqa.selenium.events.EventBus;
4748
import org.openqa.selenium.events.EventListener;
@@ -61,6 +62,7 @@ class UnboundZmqEventBus implements EventBus {
6162
private static final Logger LOG = Logger.getLogger(EventBus.class.getName());
6263
private static final Json JSON = new Json();
6364
private final AtomicBoolean pollingStarted = new AtomicBoolean(false);
65+
private final PollingRunnable socketPolling;
6466
private final ExecutorService socketPollingExecutor;
6567
private final ExecutorService socketPublishingExecutor;
6668
private final ExecutorService listenerNotificationExecutor;
@@ -147,7 +149,8 @@ class UnboundZmqEventBus implements EventBus {
147149

148150
LOG.info("Sockets created");
149151

150-
socketPollingExecutor.submit(new PollingRunnable(secret));
152+
socketPolling = new PollingRunnable(secret);
153+
socketPollingExecutor.submit(socketPolling);
151154

152155
// Give ourselves up to a second to connect, using The World's Worst heuristic. If we don't
153156
// manage to connect, it's not the end of the world, as the socket we're connecting to may not
@@ -211,9 +214,11 @@ public void fire(Event event) {
211214

212215
@Override
213216
public void close() {
214-
socketPollingExecutor.shutdownNow();
215-
socketPublishingExecutor.shutdownNow();
216-
listenerNotificationExecutor.shutdownNow();
217+
socketPolling.shutdown = true;
218+
ExecutorServices.shutdownGracefully("Event Bus Poller", socketPollingExecutor);
219+
ExecutorServices.shutdownGracefully("Event Bus Publisher", socketPublishingExecutor);
220+
ExecutorServices.shutdownGracefully(
221+
"Event Bus Listener Notifier", listenerNotificationExecutor);
217222
poller.close();
218223

219224
if (sub != null) {
@@ -226,14 +231,15 @@ public void close() {
226231

227232
private class PollingRunnable implements Runnable {
228233
private final Secret secret;
234+
private volatile boolean shutdown;
229235

230236
public PollingRunnable(Secret secret) {
231237
this.secret = secret;
232238
}
233239

234240
@Override
235241
public void run() {
236-
while (!Thread.currentThread().isInterrupted()) {
242+
while (!Thread.currentThread().isInterrupted() && !shutdown) {
237243
try {
238244
int count = poller.poll(150);
239245

py/selenium/webdriver/remote/webelement.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
from base64 import encodebytes
2626
from hashlib import md5 as md5_hash
2727
from io import BytesIO
28-
from typing import List
2928

3029
from selenium.common.exceptions import JavascriptException
3130
from selenium.common.exceptions import WebDriverException

rb/spec/integration/selenium/webdriver/bidi/network_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
#
1313
# Unless required by applicable law or agreed to in writing,
1414
# software distributed under the License is distributed on an
15-
# "AS IS" BASIS,
16-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1716
# KIND, either express or implied. See the License for the
1817
# specific language governing permissions and limitations
1918
# under the License.
2019

20+
2121
require_relative '../spec_helper'
2222

2323
module Selenium

rb/spec/integration/selenium/webdriver/network_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
#
1313
# Unless required by applicable law or agreed to in writing,
1414
# software distributed under the License is distributed on an
15-
# "AS IS" BASIS,
16-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1716
# KIND, either express or implied. See the License for the
1817
# specific language governing permissions and limitations
1918
# under the License.
2019

20+
2121
require_relative 'spec_helper'
2222

2323
module Selenium

0 commit comments

Comments
 (0)