Class HighSensitivityRegistrar
java.lang.Object
com.redhat.devtools.intellij.common.utils.HighSensitivityRegistrar
A class that allows testing and grabbing SensitivityWatchEventModifier#HIGH
reflectively. This allows the code to run in jdks where it does not exists
(ex. IBM, etc.). SensitivityWatchEventModifier#HIGH is required for the
WatchService to work ~reliably on MacOS where no native hooks but
polling is used.- See Also:
-
- "https://bugs.openjdk.java.net/browse/JDK-7133447"
- "https://stackoverflow.com/questions/9588737/is-java-7-watchservice-slow-for-anyone-else"
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanexists()get()Returns the SensitivityWatchEventModifier#HIGH if it exists (on sun jvms or openjdk),nullotherwise.protected Class<WatchEvent.Modifier>Returns the class SensitivityWatchEventModifier if it exists.protected booleanisMac()Returnstrueif the current this is running on is MacOS.booleanvoidregisterService(Path path, WatchEvent.Kind<Path>[] kinds, WatchService service)
-
Constructor Details
-
HighSensitivityRegistrar
public HighSensitivityRegistrar()
-
-
Method Details
-
isRequired
public boolean isRequired() -
isMac
protected boolean isMac()Returnstrueif the current this is running on is MacOS. Returnsfalseotherwise. Method could be private but is kept protected for testing purposes.- Returns:
- true if the current system is MacOS
-
exists
public boolean exists() -
get
Returns the SensitivityWatchEventModifier#HIGH if it exists (on sun jvms or openjdk),nullotherwise.- Returns:
- SensitivityWatchEventModifier#HIGH if it exists
-
registerService
public void registerService(Path path, WatchEvent.Kind<Path>[] kinds, WatchService service) throws IOException - Throws:
IOException
-
getSensitivityWatchEventModifierClass
protected Class<WatchEvent.Modifier> getSensitivityWatchEventModifierClass() throws ClassNotFoundExceptionReturns the class SensitivityWatchEventModifier if it exists. Throws ClassNotFoundException if it was not found. Method could be private, is kept protected for testing purposes.- Returns:
- SensitivityWatchEventModifier if it was found
- Throws:
ClassNotFoundException- if the modifier class could not be found
-