lib/openwfe/expool/expressionpool.rb in openwferu-0.9.12 vs lib/openwfe/expool/expressionpool.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
@@ -67,11 +65,11 @@
GONE = "gone"
#
# This special flow expression id is used by the forget() method
# (which is used by the forget expression and the concurrence
- # synchronization expressions)
+ # synchronization expressions)
#
GONE_PARENT_ID = FlowExpressionId.new
GONE_PARENT_ID.owfe_version = "any"
GONE_PARENT_ID.engine_id = GONE
GONE_PARENT_ID.initial_engine_id = GONE
@@ -88,22 +86,22 @@
# It's the core of the workflow engine.
# It relies on an expression storage for actual persistence of the
# expressions.
#
class ExpressionPool
- include \
- ServiceMixin,
- MonitorMixin,
- OwfeServiceLocator,
- Observable,
- WorkqueueMixin,
- FeiMixin
+ include ServiceMixin
+ include OwfeServiceLocator
+ include Observable
+ include WorkqueueMixin
+ include FeiMixin
+ include MonitorMixin
+ #
+ # code loaded from a remote URI will get evaluated with
+ # that security level
+ #
SAFETY_LEVEL = 2
- #
- # code loaded from a remote URI will get evaluated with
- # that security level
def initialize (service_name, application_context)
super()
@@ -120,21 +118,27 @@
#
# Stops this expression pool (especially its workqueue).
#
def stop
+
@stopped = true
+
stop_workqueue
+ #
+ # flushes the work queue
+
onotify :stop
end
#
# Obtains a unique monitor for an expression.
# It avoids the need for the FlowExpression instances to include
# the monitor mixin by themselves
#
def get_monitor (fei)
+
return @monitors[fei]
end
#
# This method is called by the launch method. It's actually the first
@@ -849,11 +853,11 @@
#ldebug do
# "determine_representation() from class #{param.class.name}"
#end
- param = read_uri(param) if param.is_a? URI
+ param = read_uri(param) if param.is_a?(URI)
#ldebug do
# "determine_representation() " +
# "param of class #{param.class.name}"
#end
@@ -964,19 +968,20 @@
@monitors = LruHash.new(MAX_MONITORS)
end
def [] (key)
synchronize do
- #ldebug { "[] caller :\n" + OpenWFE::caller_to_s(8) }
- mon = @monitors[key]
- if not mon
- #ldebug { "[] creating new Monitor for #{key}" }
- mon = Monitor.new
- @monitors[key] = mon
- else
- #ldebug { "[] already had Monitor for #{key}" }
- end
- return mon
+
+ (@monitors[key] ||= Monitor.new)
+ #if not mon
+ # #ldebug { "[] creating new Monitor for #{key}" }
+ # mon = Monitor.new
+ # @monitors[key] = mon
+ #else
+ # #ldebug { "[] already had Monitor for #{key}" }
+ #end
+ #
+ #mon
end
end
def delete (key)
synchronize do