Search code examples
java-moneyjsr354

Using JSR-354 ExchangeRates prevents application from exiting


I'm trying to use JavaMoney 1.0 in my application and noticed that when using default ExchangeRateProviders, some threads will still be running when my application finishes.

public static void main(String[] args) {
    MonetaryConversions.getExchangeRateProvider("IMF");
}

I'm aware that provided ExchangeRateProviders are, by default, configured to regularly fetch rates but it seems that there is a deadlock somewhere or that the thread(s) are not marked as daemons.

Or maybe there is a way to shutdown ExchangeRateProviders that I am not aware of.


Solution

  • I had the same problem. Bumping JavaMoney to version 1.1 solved the problem for me.