[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] Re: [RFA/JDWP] Event basics
From: |
Keith Seitz |
Subject: |
[cp-patches] Re: [RFA/JDWP] Event basics |
Date: |
Wed, 22 Jun 2005 14:59:17 -0700 |
On Wed, 2005-06-22 at 23:45 +0200, Cedric Berger wrote:
> Yeah, It is new in jdk 1.4, but this "new" api is not supposed to
> replace the "old" one.
> It is a lower-level API, somewhat less user-friendly, but faster and
> more powerful
> for this kind of packet-based, low-level applications. Also, you don't
> need to use
> threads, you've the C "poll()" function available.
Sadly, when I learned Java for the first time many, many moons ago,
java.nio and multiplexed I/O was only a dream.
I didn't start using Java again until about two years ago, "working" on
Eclipse. (Actually, I think it worked on me!)
> Makes sense. Actually, it wouldn't be that difficult to update the
> code. The
> toPacket could be replaced to write directly to a buffer, so it actually
> becomes
> much simpler, no more exceptions, allocations, ...
>
> public void toPacket(ByteBuffer bb, int requestId, byte suspendPolicy)
> {
> bb.put(suspendPolicy);
> bb.putInt(1);
> bb.put(_eventKind);
> bb.putInt(requestId);
> _writeData(bb);
> }
Yeah, it really is just that simple, isn't it? I'll put it on my TODO
list for previous heinous oversights that I've already committed.
Right now I have bigger fish to fry. When I'm frustrated with those,
this should be a mindless enough task to distract me. :-)
Thanks again for your input!
Keith