TransactionValidator can be restarted (IOTA uses it in the corresponding test).
There is a small problem at the 1st way:
If shutdown() is called, variable shuttingDown=true and TransactionValidator doesn't work anymore. But init() can be called and a new thread is created and started every time init is called. Quick fix is a condition has to be added to init(): a validation thread can be created and started if shuttingDown=false.
There is a big problem at the 2nd way:
If shutdown() is called, variable shuttingDown=true and TransactionValidator doesn't work anymore. Quick fix is: a line "shuttingDown.set(false);" has to be added to init().
The best solution is to set states for TransactionValidator to know what actions are available for the thread.
TransactionValidator has a problem after shutdown() is called. https://github.com/HelixNetwork/helix-1.0/blob/dev/src/main/java/net/helix/hlx/TransactionValidator.java (IOTA has the same problem)
There are two ways to use TransactionValidator:
There is a small problem at the 1st way: If shutdown() is called, variable shuttingDown=true and TransactionValidator doesn't work anymore. But init() can be called and a new thread is created and started every time init is called. Quick fix is a condition has to be added to init(): a validation thread can be created and started if shuttingDown=false.
There is a big problem at the 2nd way: If shutdown() is called, variable shuttingDown=true and TransactionValidator doesn't work anymore. Quick fix is: a line "shuttingDown.set(false);" has to be added to init().
The best solution is to set states for TransactionValidator to know what actions are available for the thread.