void () { synchronized (this) { if (isClosed()) { return; } myIsClosed = true; } try { if(Thread.currentThread() != this) { join(0); } } catch (InterruptedException e) { } // must close after the thread finished its execution, cause otherwise // the thread will try to read from the closed (and nulled) stream try { myReader.close(); } catch (IOException e1) { // supressed } checkTextAvailable(); }