Skip to content

Commit

Permalink
More PMD fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJohnson committed Feb 17, 2024
1 parent 50245fa commit 533bfe8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import edu.wpi.first.shuffleboard.api.data.ComplexData;
import edu.wpi.first.shuffleboard.api.data.ComplexDataType;
import edu.wpi.first.shuffleboard.api.data.DataTypes;
import edu.wpi.first.shuffleboard.api.data.IncompleteDataException;
import edu.wpi.first.shuffleboard.api.sources.Sources;
import edu.wpi.first.shuffleboard.plugin.networktables.util.NetworkTableUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@
import javafx.collections.ObservableList;
import javafx.collections.ObservableMap;

public final class NetworkTableSourceType extends SourceType {
public final class NetworkTableSourceType extends SourceType implements AutoCloseable {

private static NetworkTableSourceType instance;

private final ObservableList<String> availableSourceIds = FXCollections.observableArrayList();
private final ObservableMap<String, Object> availableSources = FXCollections.observableHashMap();
private final NetworkTablesPlugin plugin;
private final MultiSubscriber subscriber;
private final int listener;

@SuppressWarnings("JavadocMethod")
public NetworkTableSourceType(NetworkTablesPlugin plugin) {
Expand Down Expand Up @@ -77,6 +78,12 @@ public NetworkTableSourceType(NetworkTablesPlugin plugin) {
});
}

@Override
public void close() {
subscriber.close();
NetworkTableInstance.getDefault().removeListener(listener);
}

private void setConnectionStatus(String serverId, boolean connected) {
Platform.runLater(() -> {
String host;
Expand Down

0 comments on commit 533bfe8

Please sign in to comment.