Fwd: custom DatagramSocket and DatagramPacket
Alan Bateman
Alan.Bateman at Sun.COM
Tue Oct 30 11:05:42 PDT 2007
Roger Abelenda wrote:
> Hi I'm implementing an DatagramSocket and a
> datagramPacket and I want to subsitute the ones of the jvm with this
> ones. If you know: where may I put my code and what shall I do to make
> it compile when I compile the jvm?, and , what changes Ii need to do to
> plug it into the original code to make the jvm call my classes when
> somebody calls the original ones?. I thought to change the
> classloader.c and the resolve.c. Any other options? thanks.
>
As DatagramSocket and DatagramPacket are created by public constructors
then you'll need to replace the existing classes. As a first step, for
testing purposes, it might be easier to prepend your classes to the boot
class path rather than replacing the classes in the build. Another
approach is to create a DatagramSocketImpl and use the
setDatagramSocketImplFactory method to set a factory that instantiates
your impl rather than the default. Can you provide a few more details on
what you are trying to do? If you are trying to fix a bug or add a
feature then maybe it would be easier to contribute changes to the
existing code rather than replacing them.
-Alan.
More information about the net-dev
mailing list