Użyj jawnie wywoływanej metody czyszczenia (cleanup) zamiast metody finalize().
public void free() {
Runnable runnable = getRunnable();
Thread thread = new Thread(runnable);
thread.start();
}
private Runnable getRunnable() {
return _runnable;
}
private transient Runnable _runnable;
|
|