Hi Sanjay

You need to ensure that your queue is big enough, also remember that the
log thread can remove _all_ messages on the queue in one go. Use one queue
per worker thread.

You should also block the worker thread if the queue is full and you
can't tolerate lost log messages. Note that you should add a log message
if this occurs and increase the queue size appropriately.

Hope this helps

Joel Crisp, Senior Java Architect, SUN PS Java Center (UK)

Sanjay Nambiar wrote:
>
> Hi Joel,
> I have tried to use a queue and implement a solution where Clients threads
> that write to the queue use inter thread communication to notify a thread
> which would then pick up the data and write to a file.
> Here the getting from the queue and putting to the file methods are
> synchronized.
> The log class(helper class) is implemented as a Singleton.
> However I still lose messages along the way when the number of hits to
> writing to the queue increase in comparison to
> writing to the File.
> Joel I have not clearly understood your solution.
> Could you elaborate with my example in mind.
> Regards,
> SANJAY
>
[DELETED]

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to