dev
parent
a54d1ad330
commit
af6ccba925
|
|
@ -52,6 +52,7 @@ public class LEDThread extends Device implements Runnable {
|
|||
};
|
||||
|
||||
private ReentrantLock lock = new ReentrantLock();
|
||||
private ReentrantLock connlock = new ReentrantLock();
|
||||
protected Socket socket;
|
||||
|
||||
public LEDThread(String id, String ip) {
|
||||
|
|
@ -245,7 +246,7 @@ public class LEDThread extends Device implements Runnable {
|
|||
|
||||
@Override
|
||||
public boolean connect() throws IOException {
|
||||
lock.lock();
|
||||
connlock.lock();
|
||||
try {
|
||||
socket = new Socket();
|
||||
socket.setSoTimeout(1000);
|
||||
|
|
@ -259,7 +260,7 @@ public class LEDThread extends Device implements Runnable {
|
|||
log.error(e.getMessage(), e);
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
connlock.unlock();
|
||||
}
|
||||
|
||||
return isConnected();
|
||||
|
|
|
|||
Loading…
Reference in New Issue