Skip to content

Instantly share code, notes, and snippets.

View VincentTatan's full-sized avatar

vincentkernn VincentTatan

View GitHub Profile
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.
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
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:
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()
{
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;
/**
package Thread;
import java.util.Random;
import java.util.concurrent.locks.*;
/**
* Created by kevinsteppe on 2/10/15.
*/
public class ThreadDemoExc {
@VincentTatan
VincentTatan / output.txt
Last active October 14, 2015 05:22
ThreadDemoSOP
package Thread;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* Created by kevinsteppe on 2/10/15.
*/
public class ThreadDemoSOP
{
package Thread;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* Created by kevinsteppe on 2/10/15.
*/
public class ThreadDemoSOP
{
/*
* 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;