"kill_me()". This is the first thing needed to provide a transparent transaction
interface somewhere down the line. It is added now to support database transactions
that span multiple requests. We need this in order to send a ROLLBACK to the DB
in the case of a session killing error during a DB transaction. We don't want
to leave locks or failed transactions lying around in the DB, right?
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@94
9efc2488-bf62-4759-914b-
345cdb29e865
my $self = bless { recv_queue => [],
request_queue => [],
requests => 0,
+ death_callbacks => [],
endpoint => SERVER,
state => CONNECTING,
session_id => $sess_id,
}
}
+sub register_death_callback {
+ my $self = shift;
+ my $cb = shift;
+ push @{ $self->{death_callbacks} }, $cb;
+}
+
sub kill_me {
my $self = shift;
if( ! $self->session_id ) { return 0; }
+
+ # run each 'kill_me' callback;
+ for my $sub (@{$self->{death_callbacks}}) {
+ $sub->($self);
+ }
+
$self->disconnect;
$logger->transport( "AppSession killing self: " . $self->session_id(), DEBUG );
my @a;
}
+sub register_death_callback {
+ my $self = shift;
+ my $cb = shift;
+ $self->session->register_death_callback( $cb );
+}
package OpenSRF::AppSubrequest;