Files
HW-09-Advanced-Multithreadi…/src/main/java/dev/banking/model/BankAccount.java
T

53 lines
1.1 KiB
Java

package dev.banking.model;
public class BankAccount {
private final int accountId;
private long balance;
/*
* Students may introduce additional fields
* if required by their synchronization strategy.
*/
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();
}
}