1414
1515import java .time .Duration ;
1616import java .util .Set ;
17+ import java .util .concurrent .CancellationException ;
1718import java .util .concurrent .CopyOnWriteArraySet ;
1819import java .util .concurrent .LinkedBlockingQueue ;
1920import java .util .concurrent .ScheduledExecutorService ;
@@ -291,6 +292,8 @@ private void readNextQueuedDatapoint() {
291292 logger .trace ("Sending a Group Read Request telegram for {}" , datapoint .getDatapoint ().getMainAddress ());
292293 processCommunicator .read (datapoint .getDatapoint ());
293294 } catch (KNXException e ) {
295+ // Note: KnxException does not cover KnxRuntimeException and subclasses KnxSecureException,
296+ // KnxIllegArgumentException
294297 if (datapoint .getRetries () < datapoint .getLimit ()) {
295298 readDatapoints .add (datapoint );
296299 logger .debug ("Could not read value for datapoint {}: {}. Going to retry." ,
@@ -299,9 +302,15 @@ private void readNextQueuedDatapoint() {
299302 logger .warn ("Giving up reading datapoint {}, the number of maximum retries ({}) is reached." ,
300303 datapoint .getDatapoint ().getMainAddress (), datapoint .getLimit ());
301304 }
302- } catch (InterruptedException e ) {
305+ } catch (InterruptedException | CancellationException e ) {
303306 logger .debug ("Interrupted sending KNX read request" );
304307 return ;
308+ } catch (Exception e ) {
309+ // Any other exceptions: Fail gracefully, i.e. notify user and continue reading next DP.
310+ // Not catching this would end the scheduled read for all DPs in case of an error.
311+ // Severity is warning as this is likely caused by a configuration error.
312+ logger .warn ("Error reading datapoint {}: {}" , datapoint .getDatapoint ().getMainAddress (),
313+ e .getMessage ());
305314 }
306315 }
307316 }
0 commit comments