Adjust checkstyle rules. Make checkstyle fail the build when violations are found. Correct all current checkstyle violations.

This commit is contained in:
Ilkka Seppala
2015-12-25 23:49:28 +02:00
parent 9fbb085985
commit cec9a99410
167 changed files with 1242 additions and 969 deletions

View File

@ -5,14 +5,12 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
/**
* Producer Consumer Design pattern is a classic concurrency or threading pattern which reduces
* coupling between Producer and Consumer by separating Identification of work with Execution of
* Work.
* Producer Consumer Design pattern is a classic concurrency or threading pattern which reduces coupling between
* Producer and Consumer by separating Identification of work with Execution of Work.
* <p>
* In producer consumer design pattern a shared queue is used to control the flow and this
* separation allows you to code producer and consumer separately. It also addresses the issue of
* different timing require to produce item or consuming item. by using producer consumer pattern
* both Producer and Consumer Thread can work with different speed.
* In producer consumer design pattern a shared queue is used to control the flow and this separation allows you to code
* producer and consumer separately. It also addresses the issue of different timing require to produce item or
* consuming item. by using producer consumer pattern both Producer and Consumer Thread can work with different speed.
*
*/
public class App {
@ -20,7 +18,8 @@ public class App {
/**
* Program entry point
*
* @param args command line args
* @param args
* command line args
*/
public static void main(String[] args) {
@ -35,7 +34,7 @@ public class App {
producer.produce();
}
});
};
}
for (int i = 0; i < 3; i++) {
final Consumer consumer = new Consumer("Consumer_" + i, queue);

View File

@ -14,6 +14,9 @@ public class Consumer {
this.queue = queue;
}
/**
* Consume item from the queue
*/
public void consume() throws InterruptedException {
Item item = queue.take();

View File

@ -19,6 +19,9 @@ public class Producer {
this.queue = queue;
}
/**
* Put item in the queue
*/
public void produce() throws InterruptedException {
Item item = new Item(name, itemId++);