Accessing UNIX FileDescriptor id without reflection
eolivelli at gmail.com
Mon May 8 20:11:58 UTC 2017
Il lun 8 mag 2017, 18:38 Remi Forax <forax at univ-mlv.fr> ha scritto:
> ----- Mail original -----
> > De: "Roger Riggs" <Roger.Riggs at Oracle.com>
> > À: core-libs-dev at openjdk.java.net
> > Envoyé: Lundi 8 Mai 2017 17:45:25
> > Objet: Re: Accessing UNIX FileDescriptor id without reflection
> > Hi,
> > I would be very cautious about giving out fds for arbitrary
> > With concurrency and threading, how do you make sure that it does not
> > not get closed
> > and someone's code still has the fd and uses it later? Or worse yet,
> > the fd gets re-used
> > and then it is possible to operate on the wrong file.
> > Quite a bit of implementation code assumes it has complete control over
> > the lifecycle of
> > the FileDescriptor. Exposing the raw FD breaks the encapsulation.
> > As Rémi suggests, passing the FileDescriptor to native will at least
> > maintain the current
> > encapsulation.
I like this option. I will give it a try.
Thank you all very much
> Peter is right, i'm wrong :)
> > Roger
> > On 5/8/2017 10:14 AM, Remi Forax wrote:
> >> I agree that a method getFd should be great, we will need this kind of
> value if
> >> we want to use Panama.
> >> Did you try to serializing the FileDescriptor in memory and extract the
> >> corresponding to the file descriptor ?
> >> cheers,
> >> Rémi
> >> ----- Mail original -----
> >>> De: "Enrico Olivelli" <eolivelli at gmail.com>
> >>> À: core-libs-dev at openjdk.java.net
> >>> Envoyé: Lundi 8 Mai 2017 15:16:24
> >>> Objet: Accessing UNIX FileDescriptor id without reflection
> >>> Hi,
> >>> I am trying to port a project (Apache BookKeeper) to Java9, actually
> >>> this code uses reflection in order to access the 'fd' field of the
> >>> FileDescriptor class.
> >>> We have to access that ID in order to call low level native functions
> >>> See
> >>> # getSysFileDescriptor
> >>> Is there any way to access the FD handle without using reflection ?
> >>> If not, is it possibile to enhance the FileDescriptor API in order to
> >>> given access to the internal "fd" field ?
> >>> Thank you
> > >> Enrico Olivelli
-- Enrico Olivelli
More information about the core-libs-dev