[jboss-as7-dev] UserTransaction used by remote clients

Jaikiran Pai jpai at redhat.com
Fri Mar 9 10:27:24 EST 2012


Replies inline.

On Friday 09 March 2012 08:37 PM, Wolf-Dieter Fink wrote:
>
> But with BMT-SLSB.
> If I start the Tx at client and call a method the following code 
> return with FALSE:
> {code}
> @Stateless
> @TransactionManagement(TransactionManagementType.BEAN)
> public class BMTStatelessSessionBean implements BMTStatelessSession {
> private static final Logger LOGGER = 
> LoggerFactory.getLogger(BMTStatelessSessionBean.class);
>
> @Resource
> UserTransaction uTx;
> @Override
> public boolean checkTransaction() {
>
> try {
> if(uTx.getStatus() == Status.STATUS_ACTIVE) {
> return true;
> }
> LOGGER.error("Transaction is not Active as expected! State 
> {}",uTx.getStatus());
> } catch (SystemException e) {
> LOGGER.error("Could not check Transaction!",e);
> }
> return false;
> }
> {code}
>
> Am I wrong? If I remember correct from my examples this should work in 
> AS5.
> Or is it a bug?

The EJB 3.1 spec section 13.6.1 says this for BMT:
<quote>
The container must manage client invocations to an enterprise bean 
instance with bean-managed transaction demarcation as follows. When a 
client invokes a business method via one of the enterprise bean’s client 
views, the container suspends any transaction that may be associated 
with the client request...
</quote>
That section has much more details about how this is handled for SFSB 
and SLSB.

>
> @Jaikiran - might be a question for you
> What about loadbalancing EJB calls? If I remember rightly this was 
> planned for 7.1.1.
Load balancing is available for @Clustered beans as well as 
non-clustered beans/servers. For @Clustered beans the load balancing can 
be configured by setting the 
remote.cluster.<cluster-name>.clusternodeselector property to point to 
an implementation of the org.jboss.ejb.client.ClusterNodeSelector 
interface. Or programatically, you set it on the 
org.jboss.ejb.client.ClusterContext yourself.

For non-clustered beans, if multiple server instances/receivers within a 
client context can serve the same deployment, then we use an 
implementation of org.jboss.ejb.client.DeploymentNodeSelector to let 
that selector decide the node. Currently this isn't configurable, but 
will be in 1.1.x of ejb-client API. For 1.0.x the demand was to just 
make sure that the invocation doesn't always end up on the same node.

P.S: I don't have the code open right now, so some of the property 
names/class names might not be completely accurate.

-Jaikiran


More information about the jboss-as7-dev mailing list