Skip to content

Commit

Permalink
still another fix for #334. Simply avoid monitoring
Browse files Browse the repository at this point in the history
Ctrl-F12 will break a long running server process.
However, still need a more elegant solution to give information about the running server process and to break more elegantly.
  • Loading branch information
Eric Winger authored and Eric Winger committed Feb 25, 2019
1 parent f8b002a commit a421204
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 63 deletions.
6 changes: 4 additions & 2 deletions sources/BrowserUpdate.cls
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ debug: aBoolean
initialize
self initializeUpdates.
debug := false.
inUpdate := false!
inUpdate := false.
!

initializeUpdates
updates := OrderedCollection new.
Expand All @@ -79,6 +80,7 @@ inUpdate: anObject
issueCommand: services session: session
inUpdate ifTrue: [^self].
inUpdate := true.

[[Cursor wait showWhile: [^self basicIssueCommand: services session: session]]
ensure: [inUpdate := false]]
ifCurtailed: [inUpdate := false]!
Expand Down Expand Up @@ -173,7 +175,7 @@ updateService: service session: session

updateServices: services session: session
inUpdate ifTrue: [^self].
services isEmpty ifTrue:[^self].
services isEmpty ifTrue: [^self].
inUpdate := true.

[[Cursor wait showWhile: [^self basicUpdateServices: services session: session]]
Expand Down
64 changes: 11 additions & 53 deletions sources/GciSession.cls
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,6 @@ beInvalidSession
library := nil.
!

blocking
^blocking ifNil: [blocking := false]!

blockWhile: aBlock
blocking := true.
^aBlock ensure: [blocking := false]!

briefDescription

briefDescription ifNil: [
Expand Down Expand Up @@ -806,50 +799,17 @@ withExplanation: aString do: aBlock
do: [library session: gciSessionId continue: error errorReport contextOop]!

withExplanation: aString doA: aBlock
"Here we manage the UI feedback"

| result haveResult shouldRunEventLoop dialog |
shouldRunEventLoop := true.
haveResult := false.

[result := self handlingClientForwarderSendDo: aBlock.
haveResult := true.
shouldRunEventLoop := false.
SessionManager inputState prod]
newProcess
name: 'GciSession>>withExplanation:doA: - 1';
resume.

[
[(Delay forSeconds: 1) wait.
shouldRunEventLoop := false.
SessionManager inputState prod]
newProcess
name: 'GciSession>>withExplanation:doA: - 2';
resume.
isHandlingClientForwarderSend
ifTrue:
[SessionManager inputState loopWhile: [shouldRunEventLoop].
shouldRunEventLoop := true]
ifFalse:
[Cursor wait showWhile:
[self blocking
ifTrue: [[haveResult] whileFalse: [(Delay forMilliseconds: 1) wait]]
ifFalse:
[SessionManager inputState loopWhile: [shouldRunEventLoop].
shouldRunEventLoop := true]]].
haveResult ifTrue: [^result].
isHandlingClientForwarderSend]
whileTrue: [].

[SessionManager inputState loopWhile: [shouldRunEventLoop].
shouldRunEventLoop := true]
newProcess
name: 'GciSession>>withExplanation:doA: - 3';
resume.
[result isNil] whileTrue: [(Delay forMilliseconds: 1) wait].
SessionManager inputState pumpMessages.
^result! !
"We've (temporarily) eliminated the complicated monitoring loop
to eventually bring something that is less intrusive. Another
problem was that if server events got 'stacked up' the inputState
loopWhile: block would pick those up and run them in this thread
which is blocked. This caused many problems
See https://github.com/jgfoster/Jade/blob/master/sources/GciSession.cls
for the original implementation when we're ready to implement
an improved monitoring solution"

^self handlingClientForwarderSendDo: aBlock! !
!GciSession categoriesFor: #_executeString:fromContextOop:environment:!private! !
!GciSession categoriesFor: #_library!accessing!private! !
!GciSession categoriesFor: #_send:to:withAll:!private! !
Expand All @@ -858,8 +818,6 @@ withExplanation: aString doA: aBlock
!GciSession categoriesFor: #attemptSocket!private! !
!GciSession categoriesFor: #begin!Jade convenience!public! !
!GciSession categoriesFor: #beInvalidSession!public! !
!GciSession categoriesFor: #blocking!accessing!public! !
!GciSession categoriesFor: #blockWhile:!public! !
!GciSession categoriesFor: #briefDescription!public! !
!GciSession categoriesFor: #clearStack:!Jade!public! !
!GciSession categoriesFor: #clientForwardError:!public! !
Expand Down
2 changes: 1 addition & 1 deletion sources/JadeNavigationInspector.cls
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ queryCommand: query
ifTrue:
[query isEnabled: objectIndex < oopsCollection size.
^true].
query command == #browseClass
(query command == #browseClass or: [query command == #browseSelectedClass])
ifTrue:
[query isEnabled: true.
^true].
Expand Down
8 changes: 4 additions & 4 deletions sources/JadeiteDebuggerTestCase.cls
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ test_browseClass
debugger documentPresenter view selectionRange: (105 to: 110).
self debuggerDo: [browser := debugger methodSourcePresenter browseSelectedClass].

[self assert: (browser isKindOf: RowanSystemBrowser).
self assert: ('*String*' match: browser currentCard selectedClasses first)]
[self assert: (browser isKindOf: RowanSystemBrowserPresenter).
self assert: ('*String*' match: browser selectedClasses first)]
ensure: [self assert: browser topShell view close].
debugger documentPresenter view selectionRange: (119 to: 128).
self debuggerDo: [browser := debugger methodSourcePresenter browseSelectedClass].

[self assert: (browser isKindOf: RowanSystemBrowser).
self assert: browser currentCard selectedClassName equals: 'TranscriptStreamPortable']
[self assert: (browser isKindOf: RowanSystemBrowserPresenter).
self assert: browser selectedClassName equals: 'TranscriptStreamPortable']
ensure:
[self assert: browser topShell view close.
projectsBrowser destroy]!
Expand Down
4 changes: 2 additions & 2 deletions sources/JadeiteMethodListBrowserTestCase.cls
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ test_browseClass
ensure: [projectsBrowser destroy].
self methodSourcePresenter documentPresenter view selectionRange: (55 to: 64).
dictionaryPresenter := self methodSourcePresenter browseSelectedClass.
[self assert: dictionaryPresenter currentCard selectedClassName equals: 'TranscriptStreamPortable']
[self assert: dictionaryPresenter selectedClassName equals: 'TranscriptStreamPortable']
ensure: [dictionaryPresenter topShell destroy].
self methodSourcePresenter documentPresenter view selectionRange: (90 to: 95).
dictionaryPresenter := self methodSourcePresenter browseSelectedClass.
[self assert: ('String*' match: dictionaryPresenter currentCard selectedClassName)]
[self assert: ('String*' match: dictionaryPresenter selectedClassName)]
ensure: [dictionaryPresenter topShell destroy]!

test_doubleClickActionClassMethod
Expand Down
2 changes: 1 addition & 1 deletion sources/JadeiteProjectsBrowserPresenter.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,7 @@ refreshClass
selection
updateAfterCommand: false;
command: #fastRefresh.
gciSession blockWhile: [self issueCommand: (Array with: selection)].
self issueCommand: (Array with: selection).
selection updateAfterCommand: true.
self updateClassInfo!
Expand Down

0 comments on commit a421204

Please sign in to comment.