oshi: Updating from 3.12.1 to 3.13.2 how to set Wmi timeouts?

In v3.12.1, setting the Wmi query timeout was

WmiUtil.setWmiTimeout(500); //in ms

In v3.13.2, this was designed into a singleton pattern, sort of. It’s not clear to me how on how to use it and looking at the code, it’s not a standard singleton interface. My initial thought was this

WmiQueryHandler. instance = WmiQueryHandler.createInstance();
instance.setWmiTime(500);
WmiQueryHandler.setInstanceClass(instance);

However this will not compile. The method is expecting a class, not an instance. So I have to subclass WmiQueryHandler just to set the timeout? If that’s the case, it’s pointless to have a setWmiTimeout method as there’s no way to access a WmiQueryHandler instance outside of the createInstance method. After searching the code base, it always calls createInstance.

So the only option here is to subclass WmiQueryHandler correct? If that’s the case, I’d suggest making at least the wmiTimeout field protected instead of private, then just remove the setTimeout method.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (12 by maintainers)

Most upvoted comments

ehh leave it as is. it’s usable.