これは私のRunnableオブジェクトです(別のクラス内にあります):
private class StopFileCopy implements Runnable
{
ObjectInputStream st;
public Runnable(ObjectInputStream st)
{
this.st = st;
}
public void run()
{
if(st.read())
stopWritingToFile = true; // stopWritingToFile is an instance variable of the
// class that contains this StopFileCopy class
}
}
問題は、ストリーム「st」に整数が書き込まれる場合と書き込まれない場合があることです。そうでない場合は、この StopFileCopy オブジェクトをクラスの外部から即座に停止する必要があります。どうすればこれを達成できますか?