Class DoubletDigger
java.lang.Object
clazzfish.monitor.internal.DoubletDigger
The DoubletDigger looks for classes which appears more than once in the
classpath.
Originally the class was part of the PatternTesting project where it was located in the ClasspathMonitor till v0.6.1. But it gets too big so it was extracted to its own class.
- Author:
- oliver
-
Constructor Summary
ConstructorsConstructorDescriptionDoubletDigger
(ClasspathDigger classpathDigger) Instantiates a new doublet digger. -
Method Summary
Modifier and TypeMethodDescriptiongetDoublet
(Class<?> clazz, int nr) Gets the doublet.getDoublet
(String name, int nr) Gets the doublet.String[]
Gets the doublets.Gets the doublet list.Gets the doublet list.String[]
Gets the doublet resources.boolean
Is the given class a doublet, i.e. can it be found more than once in the classpath?boolean
Checks if is doublet.boolean
Is multi threading enabled?protected void
reset()
Resets the doubletList and maybe later other things.void
setMultiThreadingEnabled
(boolean enabled) Here you can enable or disable the (experimental) multi threading mode to see if it is really faster on a mult-core machine.toString()
To string.
-
Constructor Details
-
DoubletDigger
Instantiates a new doublet digger.- Parameters:
classpathDigger
- the classpath digger
-
-
Method Details
-
reset
protected void reset()Resets the doubletList and maybe later other things. At the moment it is only used by ClasspathMonitorTest by the testGetDoubletListPerformance() method. -
isDoublet
Is the given class a doublet, i.e. can it be found more than once in the classpath?Note: Because this method is needed by other methods like getIncompatibleClassList() in the ClasspathMonitor the result of it is cached. This speeds up this method about the factor 2000 and more:
Implementation | Mode | Score | Unit ---------------+-------+----------+------- old (till 1.4) | thrpt | 35514 | ops/s new (cached) | thrpt | 92968300 | ops/s
This results were calculated with the help of JMH and was executed on a Dell Latitude e6520 with i5 processor (i5-2540M CPU @ 2.60GHz).
- Parameters:
clazz
- the class to be checked- Returns:
- true if class is found more than once in the classpath
-
isDoublet
Checks if is doublet. If a resource appears with the same URI in the classpath this is not considered as classpath, only if it is a real doubliet.- Parameters:
name
- the name- Returns:
- true, if checks if is doublet
-
getDoublet
-
getDoublet
-
getDoubletClasses
-
getDoubletResources
-
getDoubletClassList
-
getDoubletResourceList
-
toString
-
isMultiThreadingEnabled
public boolean isMultiThreadingEnabled()Is multi threading enabled? Multi threading is automatically enabled if more than one processor is found. Otherwise you can use set via the system property "multiThreadingEnabled=true" to activate it.- Returns:
- true if multi threading is enabled for this class.
-
setMultiThreadingEnabled
public void setMultiThreadingEnabled(boolean enabled) Here you can enable or disable the (experimental) multi threading mode to see if it is really faster on a mult-core machine.- Parameters:
enabled
- true or false
-