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