Author: spadkins
Date: Tue Aug 7 12:11:26 2007
New Revision: 9826
Modified:
p5ee/trunk/App-Context/lib/App/Context.pm
Log:
tweaks to support send_async_event_in_process()
Modified: p5ee/trunk/App-Context/lib/App/Context.pm
==============================================================================
--- p5ee/trunk/App-Context/lib/App/Context.pm (original)
+++ p5ee/trunk/App-Context/lib/App/Context.pm Tue Aug 7 12:11:26 2007
@@ -2276,10 +2276,11 @@
my ($self, $event) = @_;
my $method = $event->{method};
my @args = $event->{args} ? @{$event->{args}} : ();
+ my $name = $event->{name};
my $service_type = $event->{service_type};
+ $service_type = "SessionObject" if (!$service_type && $name);
my (@results);
- if ($service_type) {
- my $name = $event->{name};
+ if ($name) {
my $service = $self->service($service_type, $name);
$self->log({level=>3},"Send Event: $service_type($name).$method(@args)\n");
@results = $service->$method(@args);
@@ -2313,9 +2314,18 @@
# See App::Context::Cluster for a context that sends a message to an
# available cluster node for executing. When the node reports back that
# it has completed the task, the callback_event is fired.
+
sub send_async_event {
&App::sub_entry if ($App::trace);
my ($self, $event, $callback_event) = @_;
+ my $event_token = $self->send_async_event_in_process($event, $callback_event);
+ &App::sub_exit($event_token) if ($App::trace);
+ return($event_token);
+}
+
+sub send_async_event_in_process {
+ &App::sub_entry if ($App::trace);
+ my ($self, $event, $callback_event) = @_;
my $errnum = 0;
my $errmsg = "";
my $event_token = "local-$$";
@@ -2326,6 +2336,7 @@
if ($@) {
$errmsg = $@;
$errnum = 1;
+ $self->log("ERROR: send_async_event_now() $event->{name}.$event->{method} : $errmsg\n");
}
if ($callback_event) {
$callback_event->{args} = [] if (! $callback_event->{args});
@@ -2708,13 +2719,13 @@
$proc = {};
$procs->{$pid} = $proc;
# print "FILE: /proc/$$/status\n";
- if (open(main::FILE, "/proc/$$/status")) {
- while (<main::FILE>) {
+ if (open(App::Context::FILE, "/proc/$$/status")) {
+ while (<App::Context::FILE>) {
if (/^Vm([A-Za-z]+):\s*([0-9]+)/) {
$proc->{lc($1)} = $2;
}
}
- close(main::FILE);
+ close(App::Context::FILE);
$proc->{text} = $proc->{exe} + $proc->{lib};
}
else {
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.