diff --git a/core/src/main/java/com/google/bitcoin/core/TransactionConfidence.java b/core/src/main/java/com/google/bitcoin/core/TransactionConfidence.java index 4b533c0a..be81ccc0 100644 --- a/core/src/main/java/com/google/bitcoin/core/TransactionConfidence.java +++ b/core/src/main/java/com/google/bitcoin/core/TransactionConfidence.java @@ -16,12 +16,10 @@ package com.google.bitcoin.core; -import com.google.bitcoin.utils.EventListenerInvoker; import com.google.common.base.Preconditions; import java.io.Serializable; import java.math.BigInteger; -import java.util.ArrayList; import java.util.ListIterator; import java.util.concurrent.CopyOnWriteArrayList; diff --git a/core/src/main/java/com/google/bitcoin/utils/EventListenerInvoker.java b/core/src/main/java/com/google/bitcoin/utils/EventListenerInvoker.java deleted file mode 100644 index f0dd964f..00000000 --- a/core/src/main/java/com/google/bitcoin/utils/EventListenerInvoker.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2012 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.bitcoin.utils; - -import java.util.List; - -/** - * A utility class that makes it easier to run lists of event listeners that are allowed to - * delete themselves during their execution. Event listeners are locked during execution.

- * - * Use like this:

- * - *

- * final Foo myself = this;
- * final Bar change = ...;
- * EventListenerInvoker.invoke(myEventListeners, new EventListenerInvoker() {
- *     public void invoke(FooEventListener listener) {
- *       listener.onSomethingChanged(myself, change);
- *     }
- * });
- * 
- */ -public abstract class EventListenerInvoker { - public abstract void invoke(E listener); - - public static void invoke(List listeners, - EventListenerInvoker invoker) { - if (listeners == null) return; - synchronized (listeners) { - for (int i = 0; i < listeners.size(); i++) { - E l = listeners.get(i); - synchronized (l) { - invoker.invoke(l); - } - if (i == listeners.size()) { - break; // Listener removed itself and it was the last one. - } else if (listeners.get(i) != l) { - i--; // Listener removed itself and it was not the last one. - } - } - } - } -}