Class HighSensitivityRegistrar
- java.lang.Object
-
- com.redhat.devtools.intellij.common.utils.HighSensitivityRegistrar
-
public class HighSensitivityRegistrar extends java.lang.ObjectA 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 theWatchServiceto 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 Constructor Description HighSensitivityRegistrar()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanexists()java.nio.file.WatchEvent.Modifierget()Returns the SensitivityWatchEventModifier#HIGH if it exists (on sun jvms or openjdk),nullotherwise.protected java.lang.Class<java.nio.file.WatchEvent.Modifier>getSensitivityWatchEventModifierClass()Returns the class SensitivityWatchEventModifier if it exists.protected booleanisMac()Returnstrueif the current this is running on is MacOS.booleanisRequired()voidregisterService(java.nio.file.Path path, java.nio.file.WatchEvent.Kind<java.nio.file.Path>[] kinds, java.nio.file.WatchService service)
-
-
-
Method Detail
-
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
public java.nio.file.WatchEvent.Modifier get()
Returns the SensitivityWatchEventModifier#HIGH if it exists (on sun jvms or openjdk),nullotherwise.- Returns:
- SensitivityWatchEventModifier#HIGH if it exists
-
registerService
public void registerService(java.nio.file.Path path, java.nio.file.WatchEvent.Kind<java.nio.file.Path>[] kinds, java.nio.file.WatchService service) throws java.io.IOException- Throws:
java.io.IOException
-
getSensitivityWatchEventModifierClass
protected java.lang.Class<java.nio.file.WatchEvent.Modifier> getSensitivityWatchEventModifierClass() throws java.lang.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:
java.lang.ClassNotFoundException- if the modifier class could not be found
-
-