lib/openwfe/engine/engine.rb in openwferu-0.9.12 vs lib/openwfe/engine/engine.rb in openwferu-0.9.12.863
- old
+ new
@@ -28,12 +28,10 @@
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#++
#
-# $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
-#
#
# "made in Japan"
#
# John Mettraux at openwfe.org
@@ -135,14 +133,15 @@
linfo { "new() --- engine started --- #{self.object_id}" }
end
#
- # Call this method once the participant for a persisted engine
+ # Call this method once the participants for a persisted engine
# have been [re]added.
- # If you call this method too soon, missing participants will
- # cause troubles... Call this method after all the participants
+ #
+ # If this method is called too soon, missing participants will
+ # cause trouble... Call this method after all the participants
# have been added.
#
def reschedule
get_expression_pool.reschedule()
end
@@ -150,11 +149,11 @@
alias :reload :reschedule
#
# When 'parameters' are used at the top of a process definition, this
# method can be used to assert a launchitem before launch.
- # An expression will get raised if the parameters do not match the
+ # An expression will be raised if the parameters do not match the
# requirements.
#
# Note that the launch method will raise those exceptions as well.
# This method can be useful in some scenarii though.
#
@@ -418,35 +417,36 @@
fei_or_wfid.workflow_instance_id
else
fei_or_wfid
end
- #Thread.pass
- # #
- # # let the flow 'stabilize' or progress before enquiring
- #fexp = get_expression_pool.fetch_expression(fei)
- #return unless fexp
- #
- # doesn't work well
-
t = Thread.new { Thread.stop }
- get_expression_pool.add_observer(:terminate) do |channel, fe, wi|
+ to = get_expression_pool.add_observer(:terminate) do |c, fe, wi|
t.wakeup if fe.fei.workflow_instance_id == wfid
end
+ te = get_expression_pool.add_observer(:error) do |c, fei, m, wi, se|
+ t.wakeup if fei.parent_wfid == wfid
+ end
ldebug { "wait_for() #{wfid}" }
t.join
+
+ get_expression_pool.remove_observer to, :terminate
+ get_expression_pool.remove_observer te, :error
+ #
+ # it would work as well without specifying the channel,
+ # but it's thus a little bit faster
end
#
# Returns a hash of ProcessStatus instances. The keys of the hash
# are workflow instance ids.
#
- # A ProcessStatus is a description of the state of a process instance
- # it enumerates the expressions where the process is currently
+ # A ProcessStatus is a description of the state of a process instance.
+ # It enumerates the expressions where the process is currently
# located (waiting certainly) and the errors the process currently
# has (hopefully none).
#
def get_process_status (wfid=nil)
@@ -498,18 +498,18 @@
#
# Lists all workflow (process) instances currently in the expool (in
# the engine).
# This method will return a list of "process-definition" expressions
- # (root of flows).
+ # (i.e. OpenWFE::DefineExpression objects -- each representing the root
+ # element of a flow).
#
- # "wfid_prefix" allows your to query for specific workflow instance
- # id prefixes.
+ # consider_subprocesses :: if true, "process-definition" expressions of
+ # subprocesses will be returned as well.
+ # wfid_prefix :: allows your to query for specific workflow instance
+ # id prefixes.
#
- # If consider_subprocesses is set to true, "process-definition"
- # expressions of subprocesses will be returned as well.
- #
def list_processes (consider_subprocesses=false, wfid_prefix=nil)
get_expression_pool.list_processes(
consider_subprocesses, wfid_prefix)
end
@@ -634,10 +634,10 @@
end
end
#
- # ProcessStatus gathers information about the status of a business
+ # ProcessStatus represents information about the status of a workflow
# process instance.
#
# The status is mainly a list of expressions and a hash of errors.
#
# Instances of this class are obtained via Engine.process_status().