flikken maastricht seizoen 6 aflevering 2

By Admin - Last updated: Thursday, October 2, 2014

I can't seem to find any example of what I want to ask:

Let's say I have in class Account

public void transferMoney(Account fromAccount, Account toAccount, DollarAmount amountToTransfer) { 
    if (fromAccount.hasSufficientBalance(amountToTransfer) { 
       fromAccount.debit(amountToTransfer); 
       toAccount.credit(amountToTransfer);
    }
}

this may cause a race condition when used in an overriden run method, and I have this code in Main:

Account acc1 = new Account(..);
Account acc2 = new Account(..);
Thread t1 = new Thread(new Transfer(..from acc1 to acc2..));
Thread t2 = new Thread(new Transfer(..from acc2 to acc1..));
synchronized (acc1) {
    t1.start();
}
synchronized (acc2) {
    t2.start()
}

Synchronizing these two instances of Account acc1 and acc2 does not prevent the Race Condition, but I don't know why or what synchronizing does exactly in this case! I couldn't find any example about this kind of synchronize.



Filename: flikken.maastricht.seizoen.6.aflevering.2.Zip
Keywords: seizoen, aflevering, maastricht, flikken
Uploaded: 2 days ago

Download flikken.maastricht.seizoen.6.aflevering.2.zip
Direct Link


Download

Download flikken.maastricht.seizoen.6.aflevering.2.zip
Mediafire


Download

Download flikken.maastricht.seizoen.6.aflevering.2.zip
Indowebster


Download

Download flikken.maastricht.seizoen.6.aflevering.2.zip
Bitshare


Download

Download flikken.maastricht.seizoen.6.aflevering.2.zip
MultiGulper


Download

Posted in All DownloadTop Of Page