Code:
class commandlistener extends Thread {
private Socket sock;
private boolean alive = false;
private Thread keepalivethread;
private Thread papathread;
commandlistener(Socket sock, Thread keepalivethread, Thread papathread) {
sock = this.sock;
keepalivethread = this.keepalivethread;
papathread = this.papathread;
this.start();
}
public void run() {
netio netz = new netio(this.sock);
while ( this.papathread.isAlive() && this.keepalivethread.isAlive() ) {
if(netz.empfangen().equals("KEEPALIVE") == false) {
this.papathread.notify();
break;
}
else {
try {
Thread.currentThread().yield();
Thread.currentThread().sleep(100);
}catch(Exception e) {e.printStackTrace(); }
}
}
}
}
in Bezug auf die ZeileException in thread "Thread-3" java.lang.NullPointerException
Code:
while ( this.papathread.isAlive() && this.keepalivethread.isAlive() ) {