Code Monkey home page Code Monkey logo

Comments (5)

hangshao0 avatar hangshao0 commented on May 17, 2024

Yes. It looks like we need to record the open count.

from openj9.

hangshao0 avatar hangshao0 commented on May 17, 2024

We could add a field to record the open count in class CpLinkedListHdr.
Increase this count by 1 if notifyClasspathEntryStateChange() is called with J9ZIP_STATE_OPEN. Decrease it by 1 if notifyClasspathEntryStateChange() is called with J9ZIP_STATE_CLOSED. Flag CPM_ZIP_OPEN should only be removed when open count is decreased to 0.

from openj9.

pshipton avatar pshipton commented on May 17, 2024

The information needed is if the classloader is holding open the jar file, and therefore the contents cannot change. On Unix platforms, the file could still change although something is holding the jar file open. I think the counting isn't a robust solution (although it would work on Windows).

from openj9.

pshipton avatar pshipton commented on May 17, 2024

Shared classes uses j9file_lastmod() to check jar file timestamps, which takes a filename parameter. Using a fd instead of a filename may resolve this issue. The shared cache doesn't currently keep fds open for the jar files, but perhaps it could do so during startup and other periods of heavy class loading. It would be easy to close fds after startup by using the J9VM_PHASE_NOT_STARTUP phase change.

It is possible to check timestamps via the fd rather than the filename (https://linux.die.net/man/2/fstat, https://msdn.microsoft.com/en-us/library/windows/desktop/ms724320(v=vs.85).aspx).

Using j9file_lastmod() is also a problem on Windows. In a startup test of Liberty it was found timestamp checking on Windows costs about 2.4%. On Windows using j9file_lastmod() involves converting the filename from utf8 to unicode, which is the likely slowdown.

from openj9.

DanHeidinga avatar DanHeidinga commented on May 17, 2024

@hangshao0 Is this something you're looking into?

from openj9.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.