Skip to content

Commit 2231294

Browse files
authored
Merge pull request #3449 from ControlSystemStudio/pva_track_search_by_cid
PVA: Track searches by CID
2 parents 9afc568 + f34bd13 commit 2231294

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

core/pva/src/main/java/org/epics/pva/client/ChannelSearch.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,31 @@ private class SearchedChannel
101101
// to handle it
102102
}
103103

104-
// Hash by channel name
104+
// Searches are identified by CID because we might have the
105+
// same channel name in different searches when we try to access
106+
// the same channel with different field(...) qualifiers.
107+
// One could try to optimize this by fetching "field()" (everything)
108+
// and then picking the subelements in the client,
109+
// but in case there's only a single PV for
110+
// pva://GigaBytePV/substruct/double_field
111+
// we'd want to use "field(substruct.double_field)"
112+
// and avoid fetching the complete structure.
113+
// ... unless there is later a PV "pva://GigaBytePV",
114+
// but we don't know, yet?
115+
116+
// Hash by CID
105117
@Override
106118
public int hashCode()
107119
{
108-
return channel.getName().hashCode();
120+
return channel.getCID();
109121
}
110122

111-
// Compare by channel name
123+
// Compare by CID
112124
@Override
113125
public boolean equals(Object obj)
114126
{
115127
if (obj instanceof SearchedChannel other)
116-
return other.channel.getName().equals(channel.getName());
128+
return other.channel.getCID() == channel.getCID();
117129
return false;
118130
}
119131
}

0 commit comments

Comments
 (0)