refactor(banking-demo): introduce DemoApplication orchestrator and add controlled lifecycle management

- Replace DemoFactory with DemoApplication to centralize system setup, execution, and shutdown
- Move ExecutorService and ScheduledExecutorService lifecycle management into application layer
- Ensure proper shutdown sequence for worker and monitoring threads
- Simplify Main class to a minimal entry-point wrapper
- Improve clarity of execution flow: build → run → shutdown
- Prevent resource leakage by explicitly awaiting termination of thread pools
This commit is contained in:
2026-06-05 20:31:08 +03:30
parent 43a53bdabf
commit 353873f10d
5 changed files with 117 additions and 83 deletions
@@ -31,7 +31,7 @@ public class BankAccount {
* TODO
* Implement a thread-safe deposit operation.
*/
public void deposit(int amount) {
public void deposit(long amount) {
throw new UnsupportedOperationException();
}
@@ -39,7 +39,7 @@ public class BankAccount {
* TODO
* Implement a thread-safe withdrawal operation.
*/
public void withdraw(int amount) {
public void withdraw(long amount) {
throw new UnsupportedOperationException();
}
@@ -47,7 +47,7 @@ public class BankAccount {
* TODO
* Implement an atomic and deadlock-free transfer.
*/
public void transfer(BankAccount target, int amount) {
public void transfer(BankAccount target, long amount) {
throw new UnsupportedOperationException();
}
}