#107 JavaDoc improvements for Poison Pill
This commit is contained in:
parent
520f81d62e
commit
2bf00c3b5e
@ -1,16 +1,22 @@
|
||||
package com.iluwatar.poison.pill;
|
||||
|
||||
/**
|
||||
* One of possible approaches to terminate Producer-Consumer pattern is using PoisonPill idiom.
|
||||
* If you use PoisonPill as termination signal then Producer is responsible to notify Consumer that exchange is over
|
||||
* and reject any further messages. Consumer receiving PoisonPill will stop to read messages from queue.
|
||||
* You also must ensure that PoisonPill will be last message that will be read from queue (if you have
|
||||
* prioritized queue than this can be tricky).
|
||||
* In simple cases as PoisonPill can be used just null-reference, but holding unique separate shared
|
||||
* object-marker (with name "Poison" or "PoisonPill") is more clear and self describing.
|
||||
* One of the possible approaches to terminate Producer-Consumer pattern is using the Poison Pill idiom.
|
||||
* If you use Poison Pill as the termination signal then Producer is responsible to notify Consumer that exchange is over
|
||||
* and reject any further messages. Consumer receiving Poison Pill will stop reading messages from the queue.
|
||||
* You must also ensure that the Poison Pill will be the last message that will be read from the queue (if you have
|
||||
* prioritized queue then this can be tricky).
|
||||
* <p>
|
||||
* In simple cases as Poison Pill can be used just null-reference, but holding unique separate shared
|
||||
* object-marker (with name "Poison" or "Poison Pill") is more clear and self describing.
|
||||
*
|
||||
*/
|
||||
public class App {
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
* @param args command line args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
MessageQueue queue = new SimpleMessageQueue(10000);
|
||||
|
||||
|
@ -3,7 +3,8 @@ package com.iluwatar.poison.pill;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Interface that implements the Message pattern and represents an inbound or outbound message as part of an {@link Producer}-{@link Consumer} exchange.
|
||||
* Interface that implements the Message pattern and represents an inbound or outbound
|
||||
* message as part of an {@link Producer}-{@link Consumer} exchange.
|
||||
*/
|
||||
public interface Message {
|
||||
|
||||
|
@ -4,6 +4,11 @@ import org.junit.Test;
|
||||
|
||||
import com.iluwatar.poison.pill.App;
|
||||
|
||||
/**
|
||||
*
|
||||
* Application test
|
||||
*
|
||||
*/
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user