Comments (5)
Thank you for your report!
Why would it prevent breaking the loop? Having entered wait
is not a prerequisite for detecting the interrupt.
Do you maybe have a concrete example for when that happened?
from calimero-core.
From my understandings entering wait is a prerequisite to detect an interrupt in the loop trough an InterruptedException, since it's a method designed to throw one if interrupt is invoked. Sure, entering wait is in general not a prerequisite to detect an interrupt, but in this loop of the calimero project it is, because it will only stop on catching an InterruptedException. I got a concrete case of this problem in a large scale application, maybe i can find the time to give a reproducing example. Thanks for the quick reply, please let me know if further information to my explanation are needed.
from calimero-core.
As I see it, your problem can be described by the following sequence (producing an execution equivalent to the event notifier):
Thread.currentThread().interrupt();
System.out.println("thread interrupted = " + Thread.currentThread().isInterrupted());
final Object lock = new Object();
try {
while (true) synchronized (lock) { lock.wait(); }
}
catch (final InterruptedException e) {
System.out.println(e);
}
System.out.println("thread exit");
Which will exit the thread, and is in accordance with the expected behavior of wait.
So yes, please provide a stack trace, snapshot, or example where this fails, so I can see the root cause.
from calimero-core.
You were right on the behavior of the interrupt flag, my bad. I had the time to dig deeper and found the root cause of the issue i saw. It's connected to the openhab issue openhab/openhab1-addons#1068. We use a similar way of connecting to calimero: When the connection is lost, calimero fires a CloseEvent. Any attached NetworkLinkListener will be fired, in the current EventNotifier Thread. If the linkClosed method of such handles the disconnection, there is no problem. In this case the connection was also handled through that method call, which will keep the old EventNotifier Thread open and drive the application into the undefined state mentioned above. For reference, the issue can be solved by spawning the reconnect task in a new Thread, through a scheduled TimerTask for example. Thanks for your help, i'll close this issue since it was a wrong use of the library.
Greetings,
Marcel
from calimero-core.
Good to know it worked out, thanks for the feedback. (The problem you describe is basically a form of thread hijacking, which should in general be avoided.)
from calimero-core.
Related Issues (20)
- [Feature Request] "protected" for some fields and methods of ManagementClientImpl HOT 6
- Warnings from Calimero HOT 13
- Receiving a GroupValueResponse with DPT 1.001 fails due to missing data in the asdu HOT 2
- DPT 251.600 format should be consistent across platforms and locales HOT 3
- readBool maxASDULen should be ‘1’ ?,now is ‘0’ HOT 1
- Android project runtime FATAL EXCEPTION. HOT 5
- GO Diagnostics: Improve selection of surrogate HOT 10
- DPT 10.001 is wrongly parsed when "no day" is present HOT 2
- Throws Exception when EventListener catch one HOT 2
- KNXNetworkLinkFT12: detect status, CEMI setting.... HOT 2
- Implement Transport Layer Connection-Oriented State Machine Style 3 HOT 2
- Throws `KNXTimeoutException` due to missing confirmation although the confirmation was received HOT 2
- Calimero GUI and KNX Virtual HOT 2
- Data Secure - Read Group Request management HOT 2
- Not able to connect to KNX USB RF module HOT 1
- Can not connect to serial port in tpuart monitor on Android HOT 7
- DPT 9.x lower boundary HOT 3
- DPT 7.003 and 7.004 unit HOT 4
- Some DPT subtypes 20.x and 21.x missing HOT 3
- ManagementClient Master Reset behavior (frame order, logging) HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from calimero-core.