eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'AbstractBackgroundJob':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: AbstractBackgroundJob


Inheritance:

   Object
   |
   +--AbstractBackgroundJob
      |
      +--BackgroundJob
      |
      +--BackgroundPeriodicalJob
      |
      +--BackgroundQueueProcessingJob

Package:
stx:libbasic2
Category:
System-Support-JobQueue
Version:
rev: 1.10 date: 2024/04/18 14:21:57
user: cg
file: AbstractBackgroundJob.st directory: libbasic2
module: stx stc-classLibrary: libbasic2

Description:


Ab AbstractBackgroundJob is a base superclass for any kind of background
processing job. Possible uses include (but not limited to): 
copying files, syntax higlighting, live searching, autosave, etc.

See subclasses for various form of background processing.

A task to be processed in a background is given to instances
in a form of a block or a message send. The background task must 
be then started by sending a #start message to the instance of 
the job. A job may be restarted any time by sending #restart or
terminated by sending #stop. Sending #start to already started
job does nothing.

Implementation note: 
The the task is actually processed in a separate, exclusive    
worker thread, so an explicit synchronization has to
be done iff the task accesses possibly shared data. 
The worker exists only iff the job is actually running. When 
the task is finished, the worker thread terminates.


[instance variables:]
    name    <String|nil>            A user friendly name of a job,
                                    useful for identifing job's thread in
                                    process list.
    job     <Block|MessageSend>     A task to perform in background.
    priority<Integer>               A priority of worker thread. Defaults to
                                    Processor userBackgroundPriority.
    thread  <Process|nil>           The worker thread
    running <Boolean>               Boolean value indicating whether
                                    tasks already started or not.




copyright

COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague All Rights Reserved Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Class protocol:

instance creation
o  named: name

o  named: name on: block

o  new
return an initialized instance

o  on: block

queries
o  isAbstract
Return if this class is an abstract class.
True is returned here for myself only; false for subclasses.
Abstract subclasses must redefine this again.


Instance protocol:

accessing
o  initiatingThread

o  initiatingThread: something

o  isDebuggerJob

o  isDebuggerJob: aBoolean
added to allow suppression of breakpoints/halts of a
job started by the debugger
(if you ask what this is for,
try to put a breakpoint into the syntaxhighlighter in the old schema)

o  job

o  job: aBlockOrMessageSend
Sets the job to be done. The job is sent
#value from the worker thread once started

o  name

o  name: aString

o  priority

o  priority: anInteger
Set the priority of a worker thread

o  thread
Return the thread (an instance of Process) that currently
processes the job or nil. if no processing is currently performed.

initialization
o  initialize
super initialize. -- commented since inherited method does nothing

private
o  setupThread: t priority: p
Sets up worker thread

processing
o  process
Actually perform the job. This method is called from the background worker thread

** This method must be redefined in concrete classes (subclassResponsibility) **

queries
o  running
Return true if the job is actually running, i.e., if it
is actually computing a value, contrary to #scheduled, that
returns true even if computation actually did not start
(i.e., thread is created but was not scheduled so far)

o  scheduled
Return true, if the job has been already started

start & stop
o  abort
Abort the job, if it is running. Similar to #stop, but raises
abort operation request so the job has a chance to terminate
gracefully

o  restart

o  start

o  startWithPriority: prio

o  startWithPriorityRange: prioRange

o  stop
raise its prio to make it terminate quickly



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 04:27:10 GMT