Skip to content

Commit eab5d39

Browse files
committed
Simple is-connected check in plain write()
1 parent 18fbd65 commit eab5d39

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

core/pv/src/main/java/org/phoebus/pv/pva/PVA_PV.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,16 @@ public void write(final Object new_value) throws Exception
175175
// in case some detail in the 'request' caused the PVA server
176176
// to perform a put-callback type of operation,
177177
// and a GUI calling write() expect an immediate return.
178+
179+
// Perform a disconnect check right now to alert caller
180+
// of clearly disconnected channel
181+
if (isDisconnected(read()))
182+
throw new Exception("Channel '" + getName() + "' is not connected");
183+
184+
// The channel could still disconnect in the middle of the write,
185+
// the channel may be read-only or experience other errors
186+
// that we'll only see as log messages since we don't want to
187+
// wait in 'get()' here...
178188
channel.write(name_helper.getWriteRequest(), new_value);
179189
}
180190

0 commit comments

Comments
 (0)