jaguar.beans.enterprise.EnterpriseBeanException class  jaguar.beans.enterprise.ServerBean interface

Appendix A: Deprecated Java Classes and Interfaces

jaguar.beans.enterprise.InstanceContext interface

Description

package com.sybase.jaguar.beans.enterprise;public interface InstanceContext extends Object

An InstanceContext object allows a Java component to influence the outcome of the transaction in which it is participating. A component method’s calls to the InstanceContext state primitives also determine the component’s state after the method completes. See “ServerBean lifecycle” for more information.

Constructors

None. A component that implements the ServerBean interface receives an InstanceContext object as a parameter to the method activate(InstanceContext, String). A component that does not implement the ServerBean interface can call Jaguar.getInstanceContext() to obtain an InstanceContext object.

Methods

Usage

See Chapter 2, “Understanding Transactions and Component Lifecycles,” in the EAServer Programmer’s Guide for a description of how components participate in transactions.

See also

jaguar.beans.enterprise.ServerBean interface, jaguar.beans.enterprise.SharedObjects interface




InstanceContext.completeWork()

Description

For transactional components, indicate that the transaction in which a component is participating should be committed. For any component, indicate that the instance should be deactivated.

Syntax

Package

com.sybase.jaguar.beans.enterprise

Interface

InstanceContext

public abstract void completeWork();

Usage

For a transactional component, completeWork() indicates that the component’s contribution to the current transaction has been successfully completed. For any component, completeWork() indicates that the component instance should be deactivated when control returns from the current component method invocation.

If the component is transactional and the component instance is the initiator of the transaction (that is, it was instantiated directly by a base client), then EAServer attempts to commit the transaction. The transaction commits unless the commit is vetoed. Depending on the components that are participating, a veto can happen in any of the following ways:

If the component instance is not the initiator of the transaction, the transaction may be rolled back when another participating instance calls rollbackWork() in addition to any of the cases listed above.

You can call completeWork(), continueWork(), and rollbackWork() many times in one method. Only the last call to execute takes effect. If you call none of these, the default behavior is that specified by continueWork().

See also

continueWork(), rollbackWork(), isRollbackOnly(), inTransaction()




InstanceContext.continueWork()

Description

Indicate that the current component instance cannot be deactivated automatically when control returns from the current component method invocation.

Syntax

Package

com.sybase.jaguar.beans.enterprise

Interface

InstanceContext

public abstract void continueWork();

Usage

Calling continueWork() indicates that the component instance should not be deactivated when the method returns. The component instance is not deactivated until one of the following happens:

You can call completeWork(), continueWork(), and rollbackWork() many times in one method. Only the last call to execute takes effect. If you call none of these, the default behavior is that specified by continueWork().

See also

completeWork(), rollbackWork(), isRollbackOnly(), inTransaction()




InstanceContext.getSharedObjects()

Description

Get a SharedObjects object that allows access to data shared among instances of a component.

Syntax

Package

com.sybase.jaguar.beans.enterprise

Interface

InstanceContext

public abstract SharedObjects getSharedObjects();

See also

jaguar.beans.enterprise.SharedObjects interface




InstanceContext.inTransaction()

Description

Determine whether the current component instance is executing in the context of a transaction.

Syntax

Package

com.sybase.jaguar.beans.enterprise

Interface

InstanceContext

public abstract boolean inTransaction();

Returns

true if the current component instance is executing as part of a transaction; false otherwise.

Usage

Java component methods can call inTransaction() to determine whether they are executing within a transaction. Methods in components that are declared to be transactional always execute as part of a transaction. See Chapter 2, “Understanding Transactions and Component Lifecycles,” in the EAServer Programmer’s Guide for more information.

See also

completeWork(), continueWork(), isRollbackOnly(), rollbackWork()




InstanceContext.isRollbackOnly()

Description

Determine if the current transaction is doomed.

Syntax

Package

com.sybase.jaguar.beans.enterprise

Interface

InstanceContext

public abstract boolean isRollbackOnly();

Returns

true if the current transaction is doomed; false if the transaction is in a committable state or if the current component instance is not executing as part of a transaction.

Usage

Call isRollbackOnly() to determine whether the current transaction is still viable.

If a component participates in a multi-component transaction, you should call isRollbackOnly() in the following places:

If the transaction is no longer viable, there is no point in continuing execution. The method should clean up and call rollbackWork() to deactivate the component instance.

See also

completeWork(), continueWork(), inTransaction(), rollbackWork()




InstanceContext.rollbackWork()

Description

For transactional components, indicate that the transaction in which a component is participating should be aborted and rolled back. For any component, indicate that the instance should be deactivated.

Syntax

Package

com.sybase.jaguar.beans.enterprise

Interface

InstanceContext

public abstract void rollbackWork();

Usage

For a transactional component, rollbackWork() indicates that the component cannot complete its contribution to the current transaction. After the method returns, the transaction is doomed: the transaction flow continues until all participating components are deactivated. At that point, the transaction is rolled back. In any component, rollbackWork() indicates that the component instance should be deactivated when control returns from the current component method invocation.You can call rollbackWork(), continueWork(), and completeWork() many times in one method; only the last call to execute takes effect. If you call none of these, the default behavior is that specified by continueWork().

Transactional components that make intercomponent method calls can call isRollbackOnly() to determine whether the current transaction is still viable or has been set to rollback only.

See also

completeWork(), continueWork(), inTransaction(), isRollbackOnly()





Copyright © 2005. Sybase Inc. All rights reserved. jaguar.beans.enterprise.ServerBean interface