> So you suggest to deprecate the use of ThreadLocal for Context? 

Yes. I think it was a bad choice to put more semantics on threads than what 
is there already, even if it was temporary. It is better and safer to be 
explicit. It seems to have been the goal from start to eventually rid this: 
in the docs, "Eventually this auto-magic will be deleted and explicit 
passing of Context into all classes that need it will be used instead."

All tests that create there own context could get different context than 
they expect so that points to the problems with the design. I would also 
propose to make Context explicitly immutable, which it effectively is now.

 
>
The idea of contexts is we don't need to carry it around on lots of 
> calls. Not sure if we want to go back to where we came from. Also afaicr 
> the context refactoring isn't finished yet. 
>
> I realise that. I think the change is not too hard to make as most key 
objects like Wallet, Chain etc already has either Context or NetworkParams.

I think unless we discard the use Context.propagate/get, uses of different 
Context in the same process are unsafe.

-- 
You received this message because you are subscribed to the Google Groups 
"bitcoinj" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bitcoinj+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to