ResourcePool

 view release on metacpan or  search on metacpan

lib/ResourcePool/Command/Execute.pm  view on Meta::CPAN

sub setExecuteException($$) {
	my ($self, $ex) = @_;
	$self->{ExecuteException} = $ex;
}

sub setPostExecuteException($$) {
	my ($self, $ex) = @_;
	$self->{PostExecuteException} = $ex;
}

sub setCleanupException($$) {
	my ($self, $ex) = @_;
	$self->{CleanupException} = $ex;
}

sub setRevertExecuteException($$) {
	my ($self, $ex) = @_;
	$self->{RevertExecuteException} = $ex;
}


sub getInitException($) {
	my ($self) = @_;
	return $self->{InitException};
}

sub getPreExecuteException($) {
	my ($self) = @_;
	return $self->{PreExecuteException};
}

sub getExecuteException($) {
	my ($self) = @_;
	return $self->{ExecuteException};
}

sub getPostExecuteException($) {
	my ($self) = @_;
	return $self->{PostExecuteException};
}

sub getCleanupException($) {
	my ($self) = @_;
	return $self->{CleanupException};
}

sub getRevertExecuteException($) {
	my ($self) = @_;
	return $self->{RevertExecuteException};
}

sub getException($) {
	my ($self) = @_;
	return $self->{InitException} 
		|| $self->{PreExecuteException}
		|| $self->{ExecuteException}
		|| $self->{PostExecuteException}
		|| $self->{CleanupException};
}

sub ok($) {
	my ($self) = @_;

	return !$self->getInitException()
		&& !$self->getPreExecuteException()
		&& !$self->getExecuteException
		&& !$self->getPostExecuteException;
}

#sub revertOk($) {
#	my ($self) = @_;
#	return $self->getPostExecuteException()
#		&& !$self->getRevertExecuteException();
#}

sub tobeRepeated($) {
	my ($self) = @_;

#	printf("tobeRepeated %d %d\n", (!$self->ok()), isNoFailoverException($self->getExecuteException()));
	return (!$self->ok()) && !isNoFailoverException($self->getException());
}

sub isNoFailoverException($) {
	my ($ex) = @_;
	my $rc;
	eval {
		$rc = $ex->isa('ResourcePool::Command::NoFailoverException');
	};
	if (! $@) {
		return $rc;	
	}
	return 0; # default, do failover
}
1;



( run in 1.178 second using v1.01-cache-2.11-cpan-524268b4103 )