need more logging jk_new_structure
authorhlopkmar
Wed, 30 Nov 2011 20:37:47 +0000
branchjk_new_structure
changeset 1195 378d34a28bd4
parent 1194 9f910257b6e8
child 1196 553f16135fd3
need more logging
src/JavaMonitor.st
src/JavaVM.st
--- a/src/JavaMonitor.st	Wed Nov 30 19:52:16 2011 +0000
+++ b/src/JavaMonitor.st	Wed Nov 30 20:37:47 2011 +0000
@@ -113,6 +113,7 @@
 !
 
 disableWait
+    Logger log: ('Waiting is disabled on monitor for %1' bindWith: owner printString) severity:#debug facility:#JVM.
     instVarAccess critical: [ waitEnabled := false ].
 
     "Created: / 30-11-2011 / 20:34:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
@@ -314,11 +315,19 @@
     | thisProcess |
     thisProcess := Processor activeProcess.
     self assert: (self isOwnedBy: thisProcess).
-    self waitEnabled ifFalse: [Logger log:( '%1 wanted to go to sleep, but it cant, this monitor is for %2 which is already dead' bindWith: thisProcess printString with: owner printString) severity: #debug facility:#JVM.     ^self.].
+    self waitEnabled ifFalse: [
+        Logger 
+            log: ('%1 wanted to go to sleep, but it cant, this monitor is for %2 which is already dead' 
+                    bindWith: thisProcess printString
+                    with: owner printString)
+            severity: #debug
+            facility: #JVM.
+        ^ self.
+    ].
     Logger 
-        log: ('%1 is going to wait for timeout: %2' 
+        log: ('%1 is going to wait on %3 for timeout: %2' 
                 bindWith: thisProcess printString
-                with: timeOut)
+                with: timeOut with: owner printString)
         severity: #debug
         facility: #JVM.
     self processesWaitingAdd: thisProcess.
@@ -337,7 +346,7 @@
 
     "Created: / 22-11-2011 / 12:52:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
     "Modified (comment): / 25-11-2011 / 18:30:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 30-11-2011 / 20:38:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+    "Modified: / 30-11-2011 / 21:31:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
 ! !
 
 !JavaMonitor methodsFor:'queries'!
--- a/src/JavaVM.st	Wed Nov 30 19:52:16 2011 +0000
+++ b/src/JavaVM.st	Wed Nov 30 20:37:47 2011 +0000
@@ -3033,7 +3033,7 @@
 threadStart: nativeContext 
     "start the thread"
     
-    | jThread  jName  name  stProcess  helper |
+    | jThread  jName  nm  stProcess  helper |
     jThread := nativeContext receiver.
     self assert: (jThread instVarNamed: 'priority') > 0.
     stProcess := JavaProcess for: (helper := JavaProcess newHelper)
@@ -3041,15 +3041,15 @@
     helper javaThreadObject: jThread.
     helper javaProcess: stProcess.
     jName := jThread instVarNamed: 'name'.
-    jName isString ifFalse: [ name := Java as_ST_String: jName. ] ifTrue: [
-        name := jName
+    jName isString ifFalse: [ nm := Java as_ST_String: jName. ] ifTrue: [
+        nm := jName
     ].
     
     "/ kludge - remember the ScreenUpdater ...
     
-    name = 'Screen Updater' ifTrue: [ JavaScreenUpdaterThread := stProcess. ] ifFalse: [
-        name = 'AWT-Windows' ifTrue: [ JavaEventThread := stProcess. ] ifFalse: [
-            (name startsWith: 'AWT-EventQueue') ifTrue: [
+    nm = 'Screen Updater' ifTrue: [ JavaScreenUpdaterThread := stProcess. ] ifFalse: [
+        nm = 'AWT-Windows' ifTrue: [ JavaEventThread := stProcess. ] ifFalse: [
+            (nm startsWith: 'AWT-EventQueue') ifTrue: [
                 JavaEventQueueThread := stProcess.
             ].
         ]
@@ -3061,11 +3061,15 @@
     
     stProcess 
         addExitAction: [
+            Logger 
+                log: ('%1 is going to die, notifying all waiters and disabling waiting on its monitor' 
+                        bindWith: jThread printString)
+                severity: #debug
+                facility: #JVM.
+            (self monitorFor: jThread) disableWait.
             self acquireMonitorAndNotifyAll: jThread.
-            
-            (self monitorFor: stProcess) disableWait.
-        ].
-    stProcess name: 'JAVA-' , name.
+        ].
+    stProcess name: 'JAVA-' , nm.
     stProcess restartable: true.
     stProcess resume.
     Java threads at: jThread put: stProcess.
@@ -3074,7 +3078,7 @@
     "Modified: / 24-12-1999 / 03:14:33 / cg"
     "Created: / 14-12-2010 / 21:31:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 15-12-2010 / 11:19:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 30-11-2011 / 20:54:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+    "Modified: / 30-11-2011 / 21:27:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
 ! !
 
 !JavaVM class methodsFor:'helpers - awt'!