3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-13 10:45:51 +00:00

Context: don't throw if the TLS slot is already set.

This commit is contained in:
Mike Hearn 2015-07-14 13:14:52 +02:00
parent 13531d98a8
commit 488b934b96

View File

@ -2,8 +2,7 @@ package org.bitcoinj.core;
import org.slf4j.*;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Preconditions.*;
// TODO: Finish adding Context c'tors to all the different objects so we can start deprecating the versions that take NetworkParameters.
// TODO: Add a working directory notion to Context and make various subsystems that want to use files default to that directory (eg. Orchid, block stores, wallet, etc).
@ -109,11 +108,8 @@ public class Context {
* want to create core BitcoinJ objects. Generally, if a class can accept a Context in its constructor and might
* be used (even indirectly) by a thread, you will want to call this first. Your task may be simplified by using
* a {@link org.bitcoinj.utils.ContextPropagatingThreadFactory}.
*
* @throws java.lang.IllegalStateException if this thread already has a context
*/
public static void propagate(Context context) {
checkState(slot.get() == null);
slot.set(checkNotNull(context));
}