[jdev] Java XMPP libraries
Tijl Houtbeckers
thoutbeckers at splendo.com
Sat May 20 19:22:38 CDT 2006
On Sat, 20 May 2006 20:26:20 +0200, Christian Cantrell
<christiancantrell at mac.com> wrote:
> On May 19, 2006, at 8:58 PM, Trejkaz wrote:
>
>> I've always used JSO to make components, it turns out to be fairly
>> simple if
>> you borrow the component example code and work from there.
>
> I can get the component working, I just don't like the architecture.
> All the examples I've seen use an infinite loop to process packets from
> the stream rather than blocking until packets come in and then routing
> them appropriately. If I knew why it was done this way, and the
> advantages, I would probably be ok with it, but it seems like an
> unnecessary waste of resources as the infinite loop is very processor
> intensive.
That's not a good assumption. I think, eg. the JSO examples do not run in
an infinite loop at all, they sleep after each poll if the previous poll
didn't return anything. Not very common in Java but not a completly new
technique either.
Granted, it's been a long time since I used JSO, and I can't say I was
wild about this part of the design, but there's no real need this should
take up any significant system resources. If it really *really* bothers
you, and you like the API enough otherwise, consider writing a patch that
handles things a little more elegant.
More information about the JDev
mailing list