Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[denonmarantz] Run the Telnet socket in a dedicated thread #9511

Merged
merged 2 commits into from
Dec 26, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class DenonMarantzTelnetConnector extends DenonMarantzConnector implement

private Future<?> telnetStateRequest;

private Future<?> telnetRunnable;
private Thread telnetRunnable;

public DenonMarantzTelnetConnector(DenonMarantzConfiguration config, DenonMarantzState state,
ScheduledExecutorService scheduler) {
Expand All @@ -69,7 +69,7 @@ public DenonMarantzTelnetConnector(DenonMarantzConfiguration config, DenonMarant
@Override
public void connect() {
telnetClient = new DenonMarantzTelnetClient(config, this);
telnetRunnable = scheduler.submit(telnetClient);
telnetRunnable = new Thread(telnetClient);
}

@Override
Expand Down Expand Up @@ -98,9 +98,11 @@ public void dispose() {
telnetStateRequest = null;
}

if (telnetClient != null && !telnetRunnable.isDone()) {
telnetRunnable.cancel(true);
if (telnetClient != null) {
telnetRunnable.interrupt();
telnetClient.shutdown();
telnetClient = null;
telnetRunnable = null;
}
}

Expand Down