私はこの方法で実行可能なものを作成しました:
private Runnable _animationScriptRunnable = new Runnable() {
public void run() {
synchronized (AnimationManager.this) {
while (!_stopRunning && !_animationScriptStack.isEmpty()) {
Class key = _animationScriptStack.removeFirst();
if (isAnimationExist(key) && isAnimationActivated(key)) {
AAnimation animation = _animationsClassTable.get(key);
animation.doBeforeAnimation();
animation.onAnimationBeginning();
do {
animation.onAnimation();
} while (isAnimationActivated(key) && animation.isAnimationRecurent() && !_stopRunning);
animation.onAnimationEnding();
animation.doAfterAnimation();
}
}
}
}
};
ご覧のとおり、同期ブロックをチェックインして、スタック(_animationScriptStack
、として作成されたLinkedList<Class<?>> _animationScriptStack
)が空でないことを確認し、空でない場合は、最初の要素を削除します。しかし、時々、私は電話で、を持ってjava.util.NoSuchElementException
いremoveFirst()
ます。
誰かが私に理由を説明できますか?