Oshi: OSHI 5.0 plans

Created on 1 Apr 2020  路  6Comments  路  Source: oshi/oshi

I'm currently working through a complete audit of the codebase for thread safety, annotating classes appropriately. I'm finding and fixing a few problems along the way. However, there are an entire set of classes that I won't be able to fix: the non-interface classes with setters on them like HWDiskStore, HWParition, NetworkIF, OSFileStore, and OSProcess. I'd like to make these interfaces instead of classes and move fields that need to be updated into the subclasses. That will also allow easier access to the updating methods that have to figure out the OS to branch off to the appropriate updating code.

Since removing the setters is API-breaking, it deserves a major version bump. However, I don't expect any other major changes, so my plan is to do as much as I can first and release a functionally-equivalent 4.x release (4.7.0) and then shortly afterwards make the setter-removal changes and move to 5.0.0. (I can also remove other deprecated code in the process.)

If anyone else has any API-breaking ideas, now's the time to submit them.

design discussion thread safety

All 6 comments

In addition to removal of setters, there are multiple API methods which return arrays. Other than a 0-length array, there is no way to prevent multiple threads from modifying the elements of an array, so these are inherently not threadsafe.

I'm trying to remember why the array vs. list choice was made earlier, as it had originally been my intent to switch to Lists in OSHI 4. I think it had to do with serialization, that we've now done away with.

Anyway, another API change will be to replace the array return values with UnmodifiableLists.

Will version 5.0.0 be java 9+ compatible?

It should be 8+ compatible. If you know of any incompatibilities with later versions please do let me know.

Is version 4.0.0 already compatible with java9+ . I have a project i want to port from java8 to java11. I haven't yet test if oshi works on it but are there any reports that it works or not? haven't found any reference

Our regular testing tests on JDKs 8, 11, 13, 14, and 15 with no issues. 4.6.0 would have been a problem with Java 9's modules, but that was fixed in 4.6.1. 5.x isn't actually going to be that much different than the existing 4.x code, just a few minor API changes.

ok thanks! i will give it a shot and report back to you ;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Nadahar picture Nadahar  路  3Comments

jflefebvre06 picture jflefebvre06  路  9Comments

Shikari0744 picture Shikari0744  路  7Comments

mprins picture mprins  路  6Comments

Sami32 picture Sami32  路  11Comments