mirror of
https://github.com/boldsuck/haveno.git
synced 2025-01-05 15:49:23 +00:00
fix error changing wallet password from default password
HavenoUtils.executeTasks() throws exception from any tasks
This commit is contained in:
parent
f1b9829b09
commit
350d2d5398
2 changed files with 14 additions and 1 deletions
|
@ -152,6 +152,8 @@ public class XmrWalletService {
|
||||||
@Override
|
@Override
|
||||||
public void onPasswordChanged(String oldPassword, String newPassword) {
|
public void onPasswordChanged(String oldPassword, String newPassword) {
|
||||||
log.info(getClass() + "accountservice.onPasswordChanged()");
|
log.info(getClass() + "accountservice.onPasswordChanged()");
|
||||||
|
if (oldPassword == null) oldPassword = MONERO_WALLET_RPC_DEFAULT_PASSWORD;
|
||||||
|
if (newPassword == null) newPassword = MONERO_WALLET_RPC_DEFAULT_PASSWORD;
|
||||||
changeWalletPasswords(oldPassword, newPassword);
|
changeWalletPasswords(oldPassword, newPassword);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,10 +38,13 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -350,7 +353,8 @@ public class HavenoUtils {
|
||||||
public static void executeTasks(Collection<Runnable> tasks, int poolSize) {
|
public static void executeTasks(Collection<Runnable> tasks, int poolSize) {
|
||||||
if (tasks.isEmpty()) return;
|
if (tasks.isEmpty()) return;
|
||||||
ExecutorService pool = Executors.newFixedThreadPool(poolSize);
|
ExecutorService pool = Executors.newFixedThreadPool(poolSize);
|
||||||
for (Runnable task : tasks) pool.submit(task);
|
List<Future<?>> futures = new ArrayList<Future<?>>();
|
||||||
|
for (Runnable task : tasks) futures.add(pool.submit(task));
|
||||||
pool.shutdown();
|
pool.shutdown();
|
||||||
try {
|
try {
|
||||||
if (!pool.awaitTermination(60, TimeUnit.SECONDS)) pool.shutdownNow();
|
if (!pool.awaitTermination(60, TimeUnit.SECONDS)) pool.shutdownNow();
|
||||||
|
@ -358,6 +362,13 @@ public class HavenoUtils {
|
||||||
pool.shutdownNow();
|
pool.shutdownNow();
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// throw exception from any tasks
|
||||||
|
try {
|
||||||
|
for (Future<?> future : futures) future.get();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String toCamelCase(String underscore) {
|
public static String toCamelCase(String underscore) {
|
||||||
|
|
Loading…
Reference in a new issue