Advertisement
Guest User

Untitled

a guest
Jan 24th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.04 KB | None | 0 0
  1. @Override
  2.         protected Void call() throws InterruptedException, IOException {
  3.             //connect
  4.             while(!Thread.currentThread().isInterrupted()) {
  5.                 do {
  6.                     try {
  7.                         plcc.connect();
  8.                         getInstance().updateCommunicationStatus("polaczono");
  9.                         Thread.sleep(5000);
  10.                     } catch(IOException ioe) {
  11.                         //System.out.println("ponawiam");
  12.                         getInstance().updateCommunicationStatus("ponawiam");
  13.                     }
  14.                 } while (!plcc.isConnected() && !Thread.currentThread().isInterrupted());
  15.                 //send request
  16.                 while(plcc.isConnected() && !plcc.isClosed() && !Thread.currentThread().isInterrupted()) {
  17.                     try {
  18.                         plcc.sendPosRequest();
  19.                     } catch (IOException ioe) {
  20.                         //System.out.println("error readera - nie zdarza sie");
  21.                         getInstance().updateCommunicationStatus("error readera");
  22.                     } catch (HandshakeException he) {
  23.                         //System.out.println("brak odpowiedzi");
  24.                         plcc.close();
  25.                         getInstance().updateCommunicationStatus("brak handshake'a");
  26.                         Thread.sleep(5000);
  27.                     }
  28.                 }
  29.             }
  30.             return null;
  31.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement