Adjust checkstyle rules. Make checkstyle fail the build when violations are found. Correct all current checkstyle violations.
This commit is contained in:
@ -7,14 +7,17 @@ import com.iluwatar.poison.pill.Message.Headers;
|
||||
*/
|
||||
public class Consumer {
|
||||
|
||||
private final MQSubscribePoint queue;
|
||||
private final MqSubscribePoint queue;
|
||||
private final String name;
|
||||
|
||||
public Consumer(String name, MQSubscribePoint queue) {
|
||||
public Consumer(String name, MqSubscribePoint queue) {
|
||||
this.name = name;
|
||||
this.queue = queue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Consume message
|
||||
*/
|
||||
public void consume() {
|
||||
while (true) {
|
||||
Message msg;
|
||||
|
@ -3,6 +3,6 @@ package com.iluwatar.poison.pill;
|
||||
/**
|
||||
* Represents abstraction of channel (or pipe) that bounds {@link Producer} and {@link Consumer}
|
||||
*/
|
||||
public interface MessageQueue extends MQPublishPoint, MQSubscribePoint {
|
||||
public interface MessageQueue extends MqPublishPoint, MqSubscribePoint {
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package com.iluwatar.poison.pill;
|
||||
/**
|
||||
* Endpoint to publish {@link Message} to queue
|
||||
*/
|
||||
public interface MQPublishPoint {
|
||||
public interface MqPublishPoint {
|
||||
|
||||
public void put(Message msg) throws InterruptedException;
|
||||
}
|
@ -3,7 +3,7 @@ package com.iluwatar.poison.pill;
|
||||
/**
|
||||
* Endpoint to retrieve {@link Message} from queue
|
||||
*/
|
||||
public interface MQSubscribePoint {
|
||||
public interface MqSubscribePoint {
|
||||
|
||||
public Message take() throws InterruptedException;
|
||||
}
|
@ -10,16 +10,22 @@ import com.iluwatar.poison.pill.Message.Headers;
|
||||
*/
|
||||
public class Producer {
|
||||
|
||||
private final MQPublishPoint queue;
|
||||
private final MqPublishPoint queue;
|
||||
private final String name;
|
||||
private boolean isStopped;
|
||||
|
||||
public Producer(String name, MQPublishPoint queue) {
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Producer(String name, MqPublishPoint queue) {
|
||||
this.name = name;
|
||||
this.queue = queue;
|
||||
this.isStopped = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send message to queue
|
||||
*/
|
||||
public void send(String body) {
|
||||
if (isStopped) {
|
||||
throw new IllegalStateException(String.format(
|
||||
@ -38,6 +44,9 @@ public class Producer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop system by sending poison pill
|
||||
*/
|
||||
public void stop() {
|
||||
isStopped = true;
|
||||
try {
|
||||
|
Reference in New Issue
Block a user