feat: add advanced multithreading banking system skeleton
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package dev.banking.model;
|
||||
|
||||
public class BankAccount {
|
||||
|
||||
private final int accountId;
|
||||
private long balance;
|
||||
|
||||
public BankAccount(int accountId, long initialBalance) {
|
||||
this.accountId = accountId;
|
||||
this.balance = initialBalance;
|
||||
}
|
||||
|
||||
public int getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO
|
||||
* Implement a thread-safe balance reader.
|
||||
*/
|
||||
public long getBalance() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO
|
||||
* Implement a thread-safe deposit operation.
|
||||
*/
|
||||
public void deposit(int amount) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO
|
||||
* Implement a thread-safe withdrawal operation.
|
||||
*/
|
||||
public void withdraw(int amount) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO
|
||||
* Implement an atomic and deadlock-free transfer.
|
||||
*/
|
||||
public void transfer(BankAccount target, int amount) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user