martiniman
(martiniman)
1
Please help with migrating to OH2.
What is syntax for ReentrantLock?
This syntax is not valid in OH2:
var Lock lock_oled = new ReentrantLock()
if (!lock_oled.isLocked) {
lock_oled.lock
try{
...
} finally {
lock_oled.unlock
}
}
Benjy
(Ben Clark)
2
Have you tried using “()” after lock and unlock? These are functions and this may be the source of the problem:
if (!lock_oled.isLocked) {
lock_oled.lock()
try{
...
} finally {
lock_oled.unlock()
}
}
If not, what is the specific error you’re getting?
martiniman
(martiniman)
3
Variable definition still requires import (but OH2 manual says that no import needed), so i add import, and designer shows no errors.
import java.util.concurrent.locks.ReentrantLock
Thank you for answer.
Benjy
(Ben Clark)
4
Glad you have it sorted, can you point us towards that page? So we can fix that?
martiniman
(martiniman)
5
Its my mistake, tutorial says about only reference org.openhab
.
1 Like