JavaProcess.st
author vranyj1
Fri, 19 Aug 2011 08:58:19 +0000
changeset 749 e898eaeff091
parent 748 da0840b7798c
child 2107 f4509f6767fa
permissions -rw-r--r--
Synchronized with CVS repository at: :ext:vrany@dialin.exept.de:/cvs/stx
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
454
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
     1
"
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
     2
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
     3
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
     4
                            SWING Research Group, Czech Technical University in Prague
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
     5
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
     6
 Parts of the code written by Claus Gittinger are under following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
     7
 license:
454
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
     8
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
     9
 This software is furnished under a license and may be used
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    10
 only in accordance with the terms of that license and with the
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    11
 inclusion of the above copyright notice.   This software may not
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    12
 be provided or otherwise made available to, or used by, any
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    13
 other person.  No title to or ownership of the software is
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    14
 hereby transferred.
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    15
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    16
 Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    17
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    18
 Permission is hereby granted, free of charge, to any person
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    19
 obtaining a copy of this software and associated documentation
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    20
 files (the 'Software'), to deal in the Software without
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    21
 restriction, including without limitation the rights to use,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    22
 copy, modify, merge, publish, distribute, sublicense, and/or sell
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    23
 copies of the Software, and to permit persons to whom the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    24
 Software is furnished to do so, subject to the following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    25
 conditions:
454
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    26
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    27
 The above copyright notice and this permission notice shall be
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    28
 included in all copies or substantial portions of the Software.
454
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    29
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    30
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    31
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    32
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    33
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    34
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    35
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    36
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    37
 OTHER DEALINGS IN THE SOFTWARE.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    38
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    39
 [1] Code written at SWING Research Group contain a signature
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    40
     of one of the above copright owners.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    41
"
713
75e92ac63bf1 category change
cg
parents: 454
diff changeset
    42
"{ Package: 'stx:libjava' }"
75e92ac63bf1 category change
cg
parents: 454
diff changeset
    43
56
dfa8d757ccea intitial checkin
cg
parents:
diff changeset
    44
Process subclass:#JavaProcess
dfa8d757ccea intitial checkin
cg
parents:
diff changeset
    45
	instanceVariableNames:'suspendedContext'
dfa8d757ccea intitial checkin
cg
parents:
diff changeset
    46
	classVariableNames:''
dfa8d757ccea intitial checkin
cg
parents:
diff changeset
    47
	poolDictionaries:''
713
75e92ac63bf1 category change
cg
parents: 454
diff changeset
    48
	category:'Languages-Java-Classes'
56
dfa8d757ccea intitial checkin
cg
parents:
diff changeset
    49
!
dfa8d757ccea intitial checkin
cg
parents:
diff changeset
    50
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    51
Object subclass:#Helper
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    52
	instanceVariableNames:'javaThreadObject javaProcess'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    53
	classVariableNames:''
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    54
	poolDictionaries:''
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    55
	privateIn:JavaProcess
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    56
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    57
454
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    58
!JavaProcess class methodsFor:'documentation'!
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    59
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    60
copyright
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    61
"
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    62
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    63
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    64
                            SWING Research Group, Czech Technical University in Prague
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    65
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    66
 Parts of the code written by Claus Gittinger are under following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    67
 license:
454
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    68
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    69
 This software is furnished under a license and may be used
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    70
 only in accordance with the terms of that license and with the
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    71
 inclusion of the above copyright notice.   This software may not
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    72
 be provided or otherwise made available to, or used by, any
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    73
 other person.  No title to or ownership of the software is
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
    74
 hereby transferred.
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    75
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    76
 Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    77
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    78
 Permission is hereby granted, free of charge, to any person
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    79
 obtaining a copy of this software and associated documentation
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    80
 files (the 'Software'), to deal in the Software without
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    81
 restriction, including without limitation the rights to use,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    82
 copy, modify, merge, publish, distribute, sublicense, and/or sell
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    83
 copies of the Software, and to permit persons to whom the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    84
 Software is furnished to do so, subject to the following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    85
 conditions:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    86
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    87
 The above copyright notice and this permission notice shall be
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    88
 included in all copies or substantial portions of the Software.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    89
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    90
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    91
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    92
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    93
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    94
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    95
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    96
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    97
 OTHER DEALINGS IN THE SOFTWARE.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    98
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
    99
 [1] Code written at SWING Research Group contain a signature
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   100
     of one of the above copright owners.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   101
454
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
   102
"
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   103
! !
454
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
   104
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   105
!JavaProcess class methodsFor:'instance creation'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   106
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   107
newHelper
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   108
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   109
    ^Helper new
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   110
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   111
    "Created: / 15-12-2010 / 11:11:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
454
38f590639d65 *** empty log message ***
cg
parents: 338
diff changeset
   112
! !
56
dfa8d757ccea intitial checkin
cg
parents:
diff changeset
   113
58
799961717413 checkin from browser
cg
parents: 56
diff changeset
   114
!JavaProcess methodsFor:'accessing'!
799961717413 checkin from browser
cg
parents: 56
diff changeset
   115
799961717413 checkin from browser
cg
parents: 56
diff changeset
   116
suspendedContext
261
d95d5a3cc475 lots of new stuff
cg
parents: 221
diff changeset
   117
    |con|
d95d5a3cc475 lots of new stuff
cg
parents: 221
diff changeset
   118
313
e2488feeb885 *** empty log message ***
cg
parents: 263
diff changeset
   119
"/    suspendedContext notNil ifTrue:[^ suspendedContext].
e2488feeb885 *** empty log message ***
cg
parents: 263
diff changeset
   120
"/    state ~~ #debug ifTrue:[
e2488feeb885 *** empty log message ***
cg
parents: 263
diff changeset
   121
"/        "/ hide non-JAVA contexts ...
e2488feeb885 *** empty log message ***
cg
parents: 263
diff changeset
   122
"/        con := super suspendedContext.
e2488feeb885 *** empty log message ***
cg
parents: 263
diff changeset
   123
"/        [con notNil] whileTrue:[
e2488feeb885 *** empty log message ***
cg
parents: 263
diff changeset
   124
"/            (con isMemberOf:JavaContext) ifTrue:[^ con].
e2488feeb885 *** empty log message ***
cg
parents: 263
diff changeset
   125
"/            con := con sender.
e2488feeb885 *** empty log message ***
cg
parents: 263
diff changeset
   126
"/        ].
e2488feeb885 *** empty log message ***
cg
parents: 263
diff changeset
   127
"/    ].
261
d95d5a3cc475 lots of new stuff
cg
parents: 221
diff changeset
   128
    ^ super suspendedContext
58
799961717413 checkin from browser
cg
parents: 56
diff changeset
   129
261
d95d5a3cc475 lots of new stuff
cg
parents: 221
diff changeset
   130
    "Created: / 7.5.1996 / 09:02:03 / cg"
313
e2488feeb885 *** empty log message ***
cg
parents: 263
diff changeset
   131
    "Modified: / 4.2.1998 / 20:44:31 / cg"
58
799961717413 checkin from browser
cg
parents: 56
diff changeset
   132
!
799961717413 checkin from browser
cg
parents: 56
diff changeset
   133
799961717413 checkin from browser
cg
parents: 56
diff changeset
   134
suspendedContext:aContext
799961717413 checkin from browser
cg
parents: 56
diff changeset
   135
    suspendedContext := aContext
799961717413 checkin from browser
cg
parents: 56
diff changeset
   136
799961717413 checkin from browser
cg
parents: 56
diff changeset
   137
    "Created: 7.5.1996 / 09:02:12 / cg"
799961717413 checkin from browser
cg
parents: 56
diff changeset
   138
! !
799961717413 checkin from browser
cg
parents: 56
diff changeset
   139
221
dc79f7c5c352 checkin from browser
cg
parents: 206
diff changeset
   140
!JavaProcess methodsFor:'interrupts'!
dc79f7c5c352 checkin from browser
cg
parents: 206
diff changeset
   141
dc79f7c5c352 checkin from browser
cg
parents: 206
diff changeset
   142
clearInterruptActions
dc79f7c5c352 checkin from browser
cg
parents: 206
diff changeset
   143
    interruptActions := nil
dc79f7c5c352 checkin from browser
cg
parents: 206
diff changeset
   144
dc79f7c5c352 checkin from browser
cg
parents: 206
diff changeset
   145
    "Created: 14.8.1997 / 17:27:22 / cg"
dc79f7c5c352 checkin from browser
cg
parents: 206
diff changeset
   146
!
dc79f7c5c352 checkin from browser
cg
parents: 206
diff changeset
   147
dc79f7c5c352 checkin from browser
cg
parents: 206
diff changeset
   148
isInterrupted
dc79f7c5c352 checkin from browser
cg
parents: 206
diff changeset
   149
    ^ interruptActions notNil
dc79f7c5c352 checkin from browser
cg
parents: 206
diff changeset
   150
dc79f7c5c352 checkin from browser
cg
parents: 206
diff changeset
   151
    "Created: 14.8.1997 / 17:26:40 / cg"
338
34bf48e76cea checkin from browser
cg
parents: 313
diff changeset
   152
!
34bf48e76cea checkin from browser
cg
parents: 313
diff changeset
   153
34bf48e76cea checkin from browser
cg
parents: 313
diff changeset
   154
markInterrupted
34bf48e76cea checkin from browser
cg
parents: 313
diff changeset
   155
    super interruptWith:[]
34bf48e76cea checkin from browser
cg
parents: 313
diff changeset
   156
34bf48e76cea checkin from browser
cg
parents: 313
diff changeset
   157
    "Modified: / 10.4.1998 / 15:20:58 / cg"
34bf48e76cea checkin from browser
cg
parents: 313
diff changeset
   158
    "Created: / 10.4.1998 / 15:21:15 / cg"
221
dc79f7c5c352 checkin from browser
cg
parents: 206
diff changeset
   159
! !
dc79f7c5c352 checkin from browser
cg
parents: 206
diff changeset
   160
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   161
!JavaProcess methodsFor:'suspend & resume'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   162
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   163
terminateNoSignal
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   164
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   165
    | jThread |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   166
    jThread := Java threads keyAtValue: self.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   167
    JavaVM wakeup: jThread.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   168
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   169
    super terminateNoSignal
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   170
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   171
    "Created: / 15-12-2010 / 00:18:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   172
    "Modified: / 15-12-2010 / 11:19:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   173
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   174
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   175
!JavaProcess::Helper methodsFor:'initialization'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   176
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   177
javaProcess:something
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   178
    javaProcess := something.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   179
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   180
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   181
javaThreadObject:something
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   182
    javaThreadObject := something.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   183
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   184
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   185
!JavaProcess::Helper methodsFor:'support'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   186
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   187
value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   188
    |procName|
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   189
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   190
    Object abortSignal 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   191
        handle:[:ex | 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   192
            procName := javaProcess name.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   193
            (procName startsWith:'JAVA-AWT-EventQueue') ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   194
                ('JAVA [info]: thread ' , procName , ' aborted - restarting process.') 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   195
                    infoPrintCR.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   196
                ex restart.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   197
            ] ifFalse:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   198
                (javaProcess == (Smalltalk at:#'JavaVM:JavaScreenUpdaterThread') 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   199
                    or:[javaProcess == (Smalltalk at:#'JavaVM:JavaEventQueueThread')]) 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   200
                        ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   201
                            ('JAVA [info]: thread ' , procName , ' aborted - restarting process.') 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   202
                                infoPrintCR.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   203
                            ex restart
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   204
                        ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   205
                        ifFalse:[('JAVA [info]: thread ' , procName , ' aborted.') infoPrintCR.]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   206
            ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   207
        ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   208
        do:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   209
            [
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   210
                JavaVM javaExceptionSignal 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   211
                    handle:[:ex | 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   212
                        |exClass|
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   213
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   214
                        procName := javaProcess name.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   215
                        exClass := ex parameter class.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   216
                        exClass == (Java at:'java.lang.ThreadDeath') ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   217
                            ('JAVA: thread ' , procName , ' terminated') infoPrintCR.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   218
                        ] ifFalse:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   219
                            Transcript 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   220
                                showCR:('JAVA: thread ''' , procName , ''' terminated with exception: ' 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   221
                                        , exClass name).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   222
                        ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   223
                        ex return.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   224
                    ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   225
                    do:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   226
                        Object messageNotUnderstoodSignal 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   227
                            handle:[:ex | 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   228
                                |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   229
                                "/ remap doesNotUnderstand with nil-receiver to
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   230
                                "/ a nullPointerException ...
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   231
                                 con m|
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   232
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   233
                                con := ex suspendedContext.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   234
                                con receiver isNil ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   235
                                    ((m := con sender method) notNil and:[m isJavaMethod]) ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   236
                                        JavaVM throwNullPointerException.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   237
                                        AbortSignal raise.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   238
                                        
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   239
                                        "/ ex proceed.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   240
                                    ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   241
                                ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   242
                                ex reject.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   243
                            ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   244
                            do:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   245
                                "/ Transcript showCR:(Timestamp now printString , 'start thread: ', stProcess name).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   246
                                javaThreadObject perform:#'run()V'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   247
                                (Smalltalk at:#'JavaVM:ThreadTrace') == true ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   248
                                    ('JAVA: thread ' , javaProcess name , ' terminated') infoPrintCR.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   249
                                ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   250
                                javaThreadObject perform:#'exit()V'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   251
                                (Smalltalk at:#'JavaVM:ThreadTrace') == true ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   252
                                    ('JAVA: after exit of thread ' , javaProcess name) infoPrintCR.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   253
                                ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   254
                            ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   255
                    ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   256
            ] ensure:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   257
                |monitors|
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   258
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   259
                monitors := (Smalltalk at:#'JavaVM:EnteredMonitorsPerProcess') 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   260
                            at:javaProcess
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   261
                            ifAbsent:nil.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   262
                monitors notNil ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   263
                    monitors do:[:obj | 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   264
                        |mon|
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   265
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   266
                        mon := JavaVM monitorFor:obj.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   267
                        mon notNil ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   268
                            mon owningProcess == javaProcess ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   269
                                ('JAVA: release monitor owned by dying thread: ' , javaProcess name) 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   270
                                    infoPrintCR.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   271
                                self breakPoint: #jv.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   272
                                mon exit
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   273
                            ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   274
                        ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   275
                    ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   276
                    (Smalltalk at:#'JavaVM:EnteredMonitorsPerProcess') removeKey:javaProcess.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   277
                    javaProcess == (Smalltalk at:#'JavaVM:JavaScreenUpdaterThread') ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   278
                        Smalltalk at:#'JavaVM:JavaScreenUpdaterThread' put:nil.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   279
                    ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   280
                    javaProcess == (Smalltalk at:#'JavaVM:JavaEventQueueThread') ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   281
                        Smalltalk at:#'JavaVM:JavaEventQueueThread' put:nil.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   282
                    ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   283
                    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   284
"/                                    screenUpdaterClass := Java at:'sun.awt.ScreenUpdater'.    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   285
"/                                    screenUpdaterClass notNil ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   286
"/                                        screenUpdaterClass instVarNamed:'updater' put:nil.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   287
"/                                    ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   288
                ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   289
                Java threads removeKey:javaThreadObject ifAbsent:[].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   290
            ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   291
        ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   292
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   293
    "Created: / 15-12-2010 / 11:06:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   294
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   295
133
adaf7cad0bc2 checkin from browser
cg
parents: 91
diff changeset
   296
!JavaProcess class methodsFor:'documentation'!
56
dfa8d757ccea intitial checkin
cg
parents:
diff changeset
   297
dfa8d757ccea intitial checkin
cg
parents:
diff changeset
   298
version
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   299
    ^ '$Id: JavaProcess.st,v 1.15 2011/08/18 18:42:48 vrany Exp $'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   300
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   301
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   302
version_SVN
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   303
    ^ '$Id: JavaProcess.st,v 1.15 2011/08/18 18:42:48 vrany Exp $'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents: 748
diff changeset
   304
! !