Skip to content

Commit 2bf00c3

Browse files
committed
iluwatar#107 JavaDoc improvements for Poison Pill
1 parent 520f81d commit 2bf00c3

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

poison-pill/src/main/java/com/iluwatar/poison/pill/App.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
package com.iluwatar.poison.pill;
22

33
/**
4-
* One of possible approaches to terminate Producer-Consumer pattern is using PoisonPill idiom.
5-
* If you use PoisonPill as termination signal then Producer is responsible to notify Consumer that exchange is over
6-
* and reject any further messages. Consumer receiving PoisonPill will stop to read messages from queue.
7-
* You also must ensure that PoisonPill will be last message that will be read from queue (if you have
8-
* prioritized queue than this can be tricky).
9-
* In simple cases as PoisonPill can be used just null-reference, but holding unique separate shared
10-
* object-marker (with name "Poison" or "PoisonPill") is more clear and self describing.
4+
* One of the possible approaches to terminate Producer-Consumer pattern is using the Poison Pill idiom.
5+
* If you use Poison Pill as the termination signal then Producer is responsible to notify Consumer that exchange is over
6+
* and reject any further messages. Consumer receiving Poison Pill will stop reading messages from the queue.
7+
* You must also ensure that the Poison Pill will be the last message that will be read from the queue (if you have
8+
* prioritized queue then this can be tricky).
9+
* <p>
10+
* In simple cases as Poison Pill can be used just null-reference, but holding unique separate shared
11+
* object-marker (with name "Poison" or "Poison Pill") is more clear and self describing.
12+
*
1113
*/
1214
public class App {
1315

16+
/**
17+
* Program entry point
18+
* @param args command line args
19+
*/
1420
public static void main(String[] args) {
1521
MessageQueue queue = new SimpleMessageQueue(10000);
1622

poison-pill/src/main/java/com/iluwatar/poison/pill/Message.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
import java.util.Map;
44

55
/**
6-
* Interface that implements the Message pattern and represents an inbound or outbound message as part of an {@link Producer}-{@link Consumer} exchange.
6+
* Interface that implements the Message pattern and represents an inbound or outbound
7+
* message as part of an {@link Producer}-{@link Consumer} exchange.
78
*/
89
public interface Message {
910

poison-pill/src/test/java/com/iluwatar/poison/pill/AppTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
import com.iluwatar.poison.pill.App;
66

7+
/**
8+
*
9+
* Application test
10+
*
11+
*/
712
public class AppTest {
813

914
@Test

0 commit comments

Comments
 (0)