Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #14945

Re: A independant pile for communication

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: A independant pile for communication
Date 2012-05-30 20:53 +0000
Organization UK Free Software Network
Message-ID <jq61bd$q7r$1@localhost.localdomain> (permalink)
References <4fc5bb99$0$1706$426a74cc@news.free.fr>

Show all headers | View raw


On Wed, 30 May 2012 08:18:01 +0200, Olve wrote:

>    I could create a pile of message, create a Thread and have this pile
> being read and displayed in run() with a wait() if the pile is empty and
> a notifyAll() when the pile is fed.

Using some sort of Queue to hold the messages would be most usual 
approach. Almost anything can be used to add messages: using transient 
threads that just add a message when its presented to your program, e.g. 
via e-mail or via a Socket, and then die is a possibility. The benefit of 
using a Queue is that the thread(s) processing the messages will block 
automatically when the Queue is empty.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

A independant pile for communication Olve <Olve@nowhere.wd.invalid> - 2012-05-30 08:18 +0200
  Re: A independant pile for communication Martin Gregorie <martin@address-in-sig.invalid> - 2012-05-30 20:53 +0000
    Re: A independant pile for communication Olve <Olve@nowhere.wd.invalid> - 2012-05-31 09:09 +0200

csiph-web