This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package aa.race; | |
import aa.StopWatch; | |
import java.util.Random; | |
import java.util.concurrent.locks.*; | |
/** | |
* | |
* This is testing code with different scenarios to test the Account class. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package queues; | |
import java.util.*; | |
import java.util.concurrent.locks.ReentrantLock; | |
/** | |
* Modify the code to have different numbers of threads removing tasks from the | |
* queue. Launch threads before you exceed the service level agreement (greater | |
* than 10000 milliseconds). Stop threads before you start processing tasks | |
* faster than the SLA (less than 5000 milliseconds). Do not remove or alter the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.locks.Lock; | |
import java.util.concurrent.locks.ReentrantLock; | |
import java.io.*; | |
/** | |
* The Account class: | |
* 1) has a current balance and a name | |
* 2) allows transfers to another account | |
* | |
* Important properties: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.locks.Lock; | |
import java.util.concurrent.locks.ReentrantLock; | |
public class ThreadDemoCounter implements Runnable | |
{ | |
private static Lock lock = new ReentrantLock(); | |
private int counter; | |
public int getCounter() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Thread; | |
import java.io.BufferedWriter; | |
import java.io.FileWriter; | |
import java.io.PrintWriter; | |
import java.math.BigInteger; | |
import java.util.concurrent.locks.Lock; | |
import java.util.concurrent.locks.ReentrantLock; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Thread; | |
import java.util.Random; | |
import java.util.concurrent.locks.*; | |
/** | |
* Created by kevinsteppe on 2/10/15. | |
*/ | |
public class ThreadDemoExc { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Thread; | |
import java.util.concurrent.locks.Lock; | |
import java.util.concurrent.locks.ReentrantLock; | |
/** | |
* Created by kevinsteppe on 2/10/15. | |
*/ | |
public class ThreadDemoSOP | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Thread; | |
import java.util.concurrent.locks.Lock; | |
import java.util.concurrent.locks.ReentrantLock; | |
/** | |
* Created by kevinsteppe on 2/10/15. | |
*/ | |
public class ThreadDemoSOP | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package practice; | |
import java.io.BufferedReader; |
NewerOlder