m_nekkanti
asked on
Read transactions from multiple files simulatenously
write a Java program that manages a simple checking account.
There are 2 simple transactions: deposit and withdrawal. Both transactions come from a simple text file with the following columns: customer_last_name, branch, branch_account_number, transaction, amount. For example:
Silver 1000 001 withdrawal 20
Smith 1001 001 withdrawal 40
Black 1000 002 deposit 20
Bush 1003 005 deposit 100
Silver 1000 001 withdrawal 40
Note that branch_account_number is only unique within a branch!
Your program should be able to read transactions from multiple files simultaneously (think how you are going to protect the integrity of your data). The program should execute the transactions, maintaining the right balances. You may hardcode the number of input files (where transactions are stored). You do not have to remember the exact syntax of file operations, etc. Make reasonable assumptions. Remember that file i/o may fail, you have to handle exceptions gracefully.
There are 2 simple transactions: deposit and withdrawal. Both transactions come from a simple text file with the following columns: customer_last_name, branch, branch_account_number, transaction, amount. For example:
Silver 1000 001 withdrawal 20
Smith 1001 001 withdrawal 40
Black 1000 002 deposit 20
Bush 1003 005 deposit 100
Silver 1000 001 withdrawal 40
Note that branch_account_number is only unique within a branch!
Your program should be able to read transactions from multiple files simultaneously (think how you are going to protect the integrity of your data). The program should execute the transactions, maintaining the right balances. You may hardcode the number of input files (where transactions are stored). You do not have to remember the exact syntax of file operations, etc. Make reasonable assumptions. Remember that file i/o may fail, you have to handle exceptions gracefully.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If there is a IO Failure, the contents won't persist in the file. You can rollback the transaction by doing nothing.
ASKER
I aked for help, the direction how I can proceed. Because I dont have experience in multithrading, deadlocks.
How can I remove this question from this forum?
How can I remove this question from this forum?
Keep all your data buffered until all the operations are completed. Persist the data when the transaction is successful.
RandomAccessFile would help you in updating/reading a file.
Regards,
Muruga