@@ -476,14 +476,15 @@ public CompletableFuture<PlcSubscriptionResponse> subscribe(PlcSubscriptionReque
476
476
.unwrap (COTPPacket ::getPayload )
477
477
.check (p -> p .getTpduReference () == tpduId )
478
478
.handle (p -> {
479
+ // Finish the request-transaction.
480
+ transaction .endRequest ();
481
+
479
482
try {
480
483
//future.complete(decodeEventSubscriptionRequest(tagName, p, subscriptionRequest));
481
484
futures .get ("DATA_" ).complete (p );
482
485
} catch (Exception e ) {
483
486
logger .warn ("Error sending 'write' message: '{}'" , e .getMessage (), e );
484
487
}
485
- // Finish the request-transaction.
486
- transaction .endRequest ();
487
488
}));
488
489
489
490
try {
@@ -555,13 +556,14 @@ public CompletableFuture<PlcUnsubscriptionResponse> unsubscribe(PlcUnsubscriptio
555
556
.unwrap (COTPPacket ::getPayload )
556
557
.check (p -> p .getTpduReference () == tpduId )
557
558
.handle (p -> {
559
+ // Finish the request-transaction.
560
+ transaction .endRequest ();
561
+
558
562
try {
559
563
future .complete (null );
560
564
} catch (Exception e ) {
561
565
logger .warn ("Error sending 'write' message: '{}'" , e .getMessage (), e );
562
566
}
563
- // Finish the request-transaction.
564
- transaction .endRequest ();
565
567
}));
566
568
567
569
return future ;
@@ -1529,9 +1531,14 @@ private CompletableFuture<S7Message> sendInternal(S7Message request) {
1529
1531
.unwrap (COTPPacket ::getPayload )
1530
1532
.check (p -> p .getTpduReference () == tpduId )
1531
1533
.handle (p -> {
1532
- future .complete (p );
1533
1534
// Finish the request-transaction.
1534
1535
transaction .endRequest ();
1536
+
1537
+ try {
1538
+ future .complete (p );
1539
+ } catch (Exception e ) {
1540
+ logger .warn ("Error sending 'write' message: '{}'" , e .getMessage (), e );
1541
+ }
1535
1542
}));
1536
1543
1537
1544
return future ;
0 commit comments