Olá, possuo o código abaixo. Estou colocando parte por se tratar de um código muito extenso, sendo assim coloco somente a parte que esta ocorrendo o erro.
public class UpStatus extends Thread{
TesteA w;
ICOM MChannel;
boolean running = true;
String wId;
int wCapacity;
int wWorkload;
UpStatus (TesteA w) {
this.w = w;
this.MChannel = this.w.MChannel;
this.wId = this.w.wId;
this.wWorkload = this.w.wWorkload;
this.wCapacity = this.w.wCapacity;
}
public void run () {
try {
while (running) {
synchronized (this) {
this.wait(10000);
}
this.sSend();
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void sSend() {
try {
this.MChannel(System.currentTimeMillis());
} catch (Exception e) {
e.printStackTrace();
}
}
}
public class TesteA {
...
public TesteA() {
UpStatus s = new UpStatus(this);
....
}
...
public void recebe() {
...
s.start();
...
}
}
public class Inicio {
public static void main... {
TesteA a = new TesteA();
a.start();
a.recebe();
}
}
Está ocorrendo
java.lang.NullPointerException
na linha this.MChannel(System.currentTimeMillis());
ALguém poderia me explicar e dizer o porque, pois não estou entendendo.