--- a/src/JavaProcess.st Wed Nov 16 13:33:38 2011 +0000
+++ b/src/JavaProcess.st Wed Nov 16 14:39:06 2011 +0000
@@ -185,53 +185,68 @@
!JavaProcess::Helper methodsFor:'support'!
value
- |procName|
-
+ | procName |
Object abortSignal
- handle:[:ex |
+ handle: [
+ :ex |
procName := javaProcess name.
- (procName startsWith:'JAVA-AWT-EventQueue') ifTrue:[
- Logger log: ('thread ' , procName , ' aborted - restarting process.') severity: #info facility: 'JVM'.
+ (procName startsWith: 'JAVA-AWT-EventQueue') ifTrue: [
+ Logger
+ log: ('thread ' , procName , ' aborted - restarting process.')
+ severity: #info
+ facility: 'JVM'.
ex restart.
- ] ifFalse:[
- (javaProcess == (Smalltalk at:#'JavaVM:JavaScreenUpdaterThread')
- or:[javaProcess == (Smalltalk at:#'JavaVM:JavaEventQueueThread')])
- ifTrue:[
- Logger log: ('thread ' , procName , ' aborted - restarting process.') severity: #info facility: 'JVM'.
+ ] ifFalse: [
+ (javaProcess == (Smalltalk at: #'JavaVM:JavaScreenUpdaterThread')
+ or: [ javaProcess == (Smalltalk at: #'JavaVM:JavaEventQueueThread') ])
+ ifTrue: [
+ Logger
+ log: ('thread ' , procName , ' aborted - restarting process.')
+ severity: #info
+ facility: 'JVM'.
ex restart
- ] ifFalse:[
- Logger log:('thread ' , procName , ' aborted.') severity: #info facility: 'JVM'.
+ ]
+ ifFalse: [
+ Logger
+ log: ('thread ' , procName , ' aborted.')
+ severity: #info
+ facility: 'JVM'.
]
].
]
- do:[
+ do: [
[
JavaVM javaExceptionSignal
- handle:[:ex |
- |exClass|
-
+ handle: [
+ :ex |
+ | exClass |
procName := javaProcess name.
exClass := ex parameter class.
- exClass == (Java at:'java.lang.ThreadDeath') ifTrue:[
- Logger log: ('thread ' , procName , ' terminated') severity: #info facility: 'JVM'.
- ] ifFalse:[
- Logger log:
- ('JAVA: thread ''' , procName , ''' terminated with exception: '
- , exClass name) severity: #info facility: 'JVM'.
+ exClass == (Java at: 'java.lang.ThreadDeath') ifTrue: [
+ Logger
+ log: ('thread ' , procName , ' terminated')
+ severity: #info
+ facility: 'JVM'.
+ ] ifFalse: [
+ Logger
+ log: ('JAVA: thread ''' , procName , ''' terminated with exception: '
+ , exClass name)
+ severity: #info
+ facility: 'JVM'.
].
ex return.
]
- do:[
+ do: [
Object messageNotUnderstoodSignal
- handle:[:ex |
- |
+ handle: [
+ :ex |
+ |
"/ remap doesNotUnderstand with nil-receiver to
"/ a nullPointerException ...
- con m|
-
+ con m |
con := ex suspendedContext.
- con receiver isNil ifTrue:[
- ((m := con sender method) notNil and:[m isJavaMethod]) ifTrue:[
+ con receiver isNil ifTrue: [
+ ((m := con sender method) notNil and: [ m isJavaMethod ]) ifTrue: [
JavaVM throwNullPointerException.
AbortSignal raise.
@@ -240,40 +255,48 @@
].
ex reject.
]
- do:[
+ do: [
"/ Transcript showCR:(Timestamp now printString , 'start thread: ', stProcess name).
[
- javaThreadObject perform:#'run()V'.
- (Smalltalk at:#'JavaVM:ThreadTrace') == true ifTrue:[
- Logger log: ('thread ' , javaProcess name , ' terminated') severity: #info facility: 'JVM'.
+ javaThreadObject perform: #'run()V'.
+ (Smalltalk at: #'JavaVM:ThreadTrace') == true ifTrue: [
+ Logger
+ log: ('thread ' , javaProcess name , ' terminated')
+ severity: #info
+ facility: 'JVM'.
].
- ] ensure:[
- javaThreadObject perform:#'exit()V'.
- (Smalltalk at:#'JavaVM:ThreadTrace') == true ifTrue:[
- Logger log: ('after exit of thread ' , javaProcess name) severity: #info facility: 'JVM'.
+ ] ensure: [
+ javaThreadObject perform: #'exit()V'.
+ (Smalltalk at: #'JavaVM:ThreadTrace') == true ifTrue: [
+ Logger
+ log: ('after exit of thread ' , javaProcess name)
+ severity: #info
+ facility: 'JVM'.
]
]
]
]
- ] ensure:[
+ ] ensure: [
+ self breakPoint:#mh.
JavaVM releaseMonitorsOfProcess: javaProcess.
-
- javaProcess == (Smalltalk at:#'JavaVM:JavaScreenUpdaterThread') ifTrue:[
- Smalltalk at:#'JavaVM:JavaScreenUpdaterThread' put:nil.
+ javaProcess == (Smalltalk at: #'JavaVM:JavaScreenUpdaterThread') ifTrue: [
+ Smalltalk at: #'JavaVM:JavaScreenUpdaterThread' put: nil.
].
- javaProcess == (Smalltalk at:#'JavaVM:JavaEventQueueThread') ifTrue:[
- Smalltalk at:#'JavaVM:JavaEventQueueThread' put:nil.
+ javaProcess == (Smalltalk at: #'JavaVM:JavaEventQueueThread') ifTrue: [
+ Smalltalk at: #'JavaVM:JavaEventQueueThread' put: nil.
].
-
+
"/ screenUpdaterClass := Java at:'sun.awt.ScreenUpdater'.
"/ screenUpdaterClass notNil ifTrue:[
"/ screenUpdaterClass instVarNamed:'updater' put:nil.
"/ ].
- Java threads removeKey:javaThreadObject ifAbsent:[].
+
+ Java threads removeKey: javaThreadObject ifAbsent: [].
]
]
"Created: / 15-12-2010 / 11:06:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 16-11-2011 / 15:10:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaProcess class methodsFor:'documentation'!