Re: Prevayler + BlockingQueue

Klaus Wuestefeld <[email protected]> Wed, 24 Aug 2016 10:22:06 -0300
Newsgroups gmane.comp.java.prevayler
Message-ID <CAMAooZGEimGCT0L9xhv18D9s6Cn-WyhRzdk_WYYmZt-JCJrySQ@mail.gmail.com>
Hi Attila,

Add a WaitForDocument blocking read operation. It waits for a document
but does not take it, so Take will always work immediately. Since
WaitForDocument is blocking, you cannot use a Prevayler Query. You do
it acessing your objects directly.

Would that work?

Klaus

On Wed, Aug 24, 2016 at 8:21 AM, Attila Magyar <[email protected]> wrote:
> Hi,
>
> I tried to use Prevayler on a Java BlockingQueue in a naive way, and it
> didn't work the way I expected. I guess I see the reason why, but I'm still
> not sure how should I use it.
>
> Here is an example code I wrote it
>
> https://gist.github.com/zeroflag/8c7333e96ab9b8c8a09fa0a3b08bb907
>
> There are 2 commands. AddDocument adds a new document to the queue,
> TakeDocument removes a document from the queue. Both operations blocks the
> current thread, and probably this is the problem. I assume prevayler uses
> locks on each transactions therefore taking document from an empty queue
> blocks other threads from adding a new document.
>
> My goal is to have a simple persistent (blocking) queue.
>
> Is there any simple way to make this work, or what other options do I have?
>
> thanks
> Attila
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> To unsubscribe go to the end of this page:
> http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
> _______________________________________________
> "Databases in Memoriam" -- http://www.prevayler.org
>



-- 
Valeu, Klaus.

------------------------------------------------------------------------------
_______________________________________________
To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
_______________________________________________
"Databases in Memoriam" -- http://www.prevayler.org