Ticket #2241 (closed bug: obsolete)

Opened 10 years ago

Last modified 8 years ago

native-processes-not-closing -- Native processes should be closed when not used

Reported by: deyan Owned by: meddle
Priority: major Milestone: X3
Component: uncategorized Version: 2.0
Keywords: Cc:
Category: unknown Effort:
Importance: 97 Ticket_group:
Estimated Number of Hours: 0 Add Hours to Ticket: 0
Billable?: yes Total Hours: 0
Analysis_owners: deyan Design_owners: meddle
Imp._owners: meddle Test_owners:
Analysis_reviewers: meddle Changelog: Changelog
Design_reviewers: pap Imp._reviewers: pap
Test_reviewers: Analysis_score: 4
Design_score: 4 Imp._score: 4
Test_score: 0

Description

Media decoders and browser embed should be closed after a timeout when not used. Browser embed should be closed after the book containing brwoser frame is closed.

Attachments

2241.patch (10.9 KB) - added by meddle 9 years ago.
Design related code
2241_final.patch (15.6 KB) - added by meddle 9 years ago.
Implementation code

Change History

comment:1 Changed 9 years ago by deyan

  • Importance set to 97
  • Status changed from new to s1b_analysis_finished

comment:2 Changed 9 years ago by deyan

  • Milestone set to X3

comment:3 Changed 9 years ago by meddle

  • Status changed from s1b_analysis_finished to s2a_design_started
  • Analysis_reviewers set to meddle
  • Analysis_score changed from 0 to 4

The analysis is ok for me 4p

comment:4 Changed 9 years ago by meddle

  • Design_owners set to meddle

comment:5 Changed 9 years ago by meddle

The design:

  • All the NativeBridges in sophie will be registered in a special NativeBridgeRegistry.
    • The registry will have a daemon TimerTask that checks if some of the first n% (20% in the moment) are active for given time (5 seconds in the moment, and the task checks on 4 seconds). If there are such processes, they are unregistered - stopped and removed from the registry.
    • The NativeBridge interface will have public long getLastCalled method which will be used to sort the bridges in the registry. A TreeSet will be used for the sorting.
    • When a NativeBridge's stdin or stdout is used the last called time will be updated to be the current time.
    • Also the asserts for running will be removed, because the processes now can be stopped, but always when reading or writing to the natives they will be started if stopped.
    • The registry will be singleton for now, if you have problems with that give suggestions (The prolib registry is also a singleton)
  • Quiting Sophie 2:
    • In the MainWindowLogic#ON_CLOSE the line MediaUtil.getDefaultAudioOutput().stop(); will be changed to NativeBridgeRegistry.get().unregisterAll();, which unregisters all the bridges in the registry, this works (tested).
    • I recommend testing on windows too.

Changed 9 years ago by meddle

Design related code

comment:6 Changed 9 years ago by meddle

  • Status changed from s2a_design_started to s2b_design_finished

comment:7 Changed 9 years ago by meddle

Found problem:

  • The Browser process when restarted does not resize and load the Browser content properly:
    • Save the size and the last loaded url of the browser on resizing and loading and when restarting the process resize it and load the saved url.
    • Make sure that every time the timeline of the page is restarted the browser shows it initial set url.

comment:8 Changed 9 years ago by pap

  • Status changed from s2b_design_finished to s2c_design_ok
  • Design_score changed from 0 to 4
  • Design_reviewers set to pap
  • It would be nice if in the JavaDoc you mention the measurement units (seconds, miliseconds, etc.)
  • Generally it is good to have some reason when you chose these constants you use.
  • I think that it may be better if you put the class specific things first and after them the nested classes.
  • Why don't you name "unregister" "unregisterFirst" ?
  • Otherwise seems ok, provided that there will not be too many processes to manipulate.
  • It may be good if you mention somewhere in the javadoc (perhaps that of NativeBridge) that processes get killed and that natives themselves should be designed stateless enough (The browser reminded me about that).

comment:9 Changed 9 years ago by meddle

  • Owner set to meddle
  • Status changed from s2c_design_ok to s3a_implementation_started
  • Imp._owners set to meddle

Changed 9 years ago by meddle

Implementation code

comment:10 Changed 9 years ago by meddle

  • Status changed from s3a_implementation_started to s3b_implementation_finished

Implemented and tested, with the design comments in mind. Test it on the Mac I presume, but may be windows is good too to try if the ugly windows exception is gone...

comment:11 Changed 9 years ago by pap

  • Cc meddle added
  • Status changed from s3b_implementation_finished to s3c_implementation_ok
  • Imp._score changed from 0 to 4
  • Imp._reviewers set to pap
  • Commited in [8569].
  • You could have a bit better variable naming :)
  • I like it so much

comment:12 Changed 9 years ago by meddle

  • Cc meddle removed
  • Changelog set to [wiki:Changelog]

comment:13 Changed 8 years ago by meddle

  • Status changed from s3c_implementation_ok to closed
  • Resolution set to obsolete

Closing all the tickets before M Y1

Note: See TracTickets for help on using tickets.