Friday, 15 June 2012

java - How can I override SocketChannelImpl class in order to use the same FileDescriptor in two different SocketChannelImpl objects? -



java - How can I override SocketChannelImpl class in order to use the same FileDescriptor in two different SocketChannelImpl objects? -

i want override jdk implementation of sun.nio.ch.socketchannelimpl have access filedescriptor , can create sec socketchannelimpl existing filedescriptor.

i can't quite seem figure out how forcefulness instance of socketchannelimpl load in vm before jdk version. can't seem find instance of doing same thing.

do have build rt.jar , swap in version?

update: wanted know still looking issue. know java vm prevents forced modification things selector , have not yet tried experiment socketchannelimpl (having alter top level class windowsasynchonoussocketchannelimpl) , default provider behavior. repost in here if when find out more java , won't allow in scenario.

according source code: http://www.docjar.com/html/api/sun/nio/ch/socketchannelimpl.java.html socketchannelimpl class not final, has public getter filedescriptor property , package-private constructor accepts filedescriptor.

hence should able retrieve existing filedescriptor 1 socketchannelimpl , either:

extend socketchannelimpl , create constructor passes given filedescriptor super class' constructor, or

use reflection api retrieve package-private constructor , utilize create new instance of socketchannelimpl.

java

No comments:

Post a Comment