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

Use ConcurrentHashMap for static collection of NT sources #779

Merged
merged 2 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -42,7 +42,7 @@
@Description(
group = "edu.wpi.first.shuffleboard",
name = "NetworkTables",
version = "2.3.1",
version = "2.3.2",
summary = "Provides sources and widgets for NetworkTables"
)
public class NetworkTablesPlugin extends Plugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import edu.wpi.first.networktables.NetworkTableInstance;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;

/**
* A source for data in network tables. Data can be a single value or a map of keys to values.
Expand All @@ -28,7 +28,7 @@
*/
public abstract class NetworkTableSource<T> extends AbstractDataSource<T> {

private static final Map<String, NetworkTableSource> sources = new HashMap<>();
private static final Map<String, NetworkTableSource> sources = new ConcurrentHashMap<>();

protected final String fullTableKey;
private int listenerUid = -1;
Expand Down