JavaRelease: avoid useless and costly auto-detection of system release
When a system release cannot be determined, try only once and return
nil directly on subsequent calls to `JavaRelease class>>system`. This
significantly speeds up settings dialog in such case.
--- a/JavaRelease.st Fri Apr 08 10:35:17 2016 +0100
+++ b/JavaRelease.st Wed Apr 13 20:41:15 2016 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1996-2015 by Claus Gittinger
@@ -26,7 +24,7 @@
Object subclass:#JavaRelease
instanceVariableNames:'javaHome sourcePath classes bundle bootClassPath'
- classVariableNames:'System'
+ classVariableNames:'System SystemInitialized'
poolDictionaries:''
category:'Languages-Java-Support'
!
@@ -170,12 +168,25 @@
Java release: nil.
instance := nil.
self subclasses do:[:e|e flush].
+ System := nil.
+ SystemInitialized := false.
"
JavaRelease flush.
"
"Created: / 12-02-2013 / 03:20:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 13-04-2016 / 20:30:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+initialize
+ SystemInitialized := false.
+
+ "
+ JavaRelease flush.
+ "
+
+ "Created: / 13-04-2016 / 20:30:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaRelease class methodsFor:'instance creation'!
@@ -424,11 +435,12 @@
^ release.
].
]
+
].
^ nil.
"Created: / 08-04-2014 / 14:12:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 17-04-2014 / 20:03:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 13-04-2016 / 20:25:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
inDirectory:javaHome
@@ -462,7 +474,7 @@
| javaExecutable |
- System isNil ifTrue:[
+ SystemInitialized ifFalse:[
"/ On Windows, search registry first...
OperatingSystem isMSWINDOWSlike ifTrue:[
"Search for JDK first..."
@@ -524,6 +536,7 @@
System := System class instance
].
].
+ SystemInitialized := true.
].
^ System
@@ -534,7 +547,7 @@
"
"Created: / 11-11-2013 / 14:18:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (comment): / 09-12-2014 / 14:03:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 13-04-2016 / 20:31:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaRelease class methodsFor:'instance creation-private'!
@@ -3261,3 +3274,5 @@
^ '$Id: JavaRelease.st,v 1.19 2015-03-31 07:43:05 az Exp $'
! !
+
+JavaRelease initialize!