1

As part of our plans to integrate blockchain technology, I am looking at Ethereum and playing around with the java API (web3j). One obviously starts with the examples but I found that the VM does not actually stop after all example code has completed. The example code seems to be cleaning up all the resources it acquires but since the VM is not actually stopping, I am assuming it is leaving some thread running and the VM is waiting on that thread to complete.

I have added the following at the end of the Main#run() method:

System.out.println("Main done, expect the VM to quit anytime now");

and that prints out fine so the code completes. I have also added a shutdown hook but that never gets invoked.

I was wondering if anybody else is experiencing the same thing and how they have solved it or if there is perhaps a more fundamental flaw in the Web3J library that does not cleanup acquired resources?

Many thanks!

  • How are you using web3j? Are you starting everything manually or are you using the spring boot starter? Are you using the synchronous, asynchronous or reactive API? I think your problem might be solvable if you provide some code. – javahippie Dec 7 '17 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.