FileDocCategorySizeDatePackage
SenderReceiver.javaAPI DocGlassfish v2 API8853Fri May 04 22:36:38 BST 2007com.sun.jts.CosTransactions

SenderReceiver

public class SenderReceiver extends Object implements Sender, Receiver
The SenderRecevier class is our implemention of the OTS Sender and Receiver classes.

Their method are implemented here as passthroughs to avoid dependency on the CosTSPortability package in com.ibm.jts.implement. This is because CosTSPortability is a deprecated interface in the OMG specification.

version
0.1
author
Simon Holdsworth, IBM Corporation
see

Fields Summary
private static final boolean
debug
private static SenderReceiver
sendRec
static Logger
_logger
Constructors Summary
SenderReceiver()
Default constructor.

param
return
see


              
     
Methods Summary
private voiddebugMessage(java.lang.String msg, int id, PropagationContext ctx)

		//System.err.print is not removed as debug Message will no more be
		//used.
		_logger.log(Level.FINE,msg+";"+id);
        if (ctx == null) {
			_logger.log(Level.FINE,"");
        } else {
			_logger.log(Level.FINE,"," + ctx.current.otid.formatID);
        }
    
static voididentify(TSIdentification ident)
Identifies an instance of this class to the TSIdentification object.

param
ident The TSIdentification object.
return
see

        try {
            ident.identify_sender(sendRec);
            ident.identify_receiver(sendRec);
            if (debug) {
                _logger.log(Level.FINE,"Sender/Receiver "+ sendRec +
                                   " successfully identified");
            }
        } catch(AlreadyIdentified exc) {
			_logger.log(Level.FINE,"jts.already_indetified_communication_manager");
        } catch (NotAvailable exc) {
			_logger.log(Level.WARNING,"jts.unable_to_indetify_communication_manager");
        }
    
public voidreceived_reply(int id, PropagationContext context, org.omg.CORBA.Environment ex)
Pass the operation through to the CurrentTransaction class.

param
id The request identifier.
param
context The PropagationContext from the message.
param
ex The exception on the message.
return
exception
WrongTransaction The context returned on the reply is for a different transaction from the current one on the thread.
see


        if (debug) {
			_logger.log(Level.FINE,"In received_reply"+
					":"+id+","+context.current.otid.formatID);
        }

        CurrentTransaction.receivedReply(id, context, ex);

        if (debug) {
			_logger.log(Level.FINE,"Out received_reply"+
					":"+id+","+context.current.otid.formatID);
        }
    
public voidreceived_request(int id, PropagationContext context)
Pass the operation through to the CurrentTransaction class.

param
id The request identifier.
param
context The PropagationContext from the message.
return
see


        if (debug) {
			_logger.log(Level.FINE,"In received_request"+
					":"+id+","+context.current.otid.formatID);
        }

        CurrentTransaction.receivedRequest(id, context);

        if (debug) {
			_logger.log(Level.FINE,"Out received_request"+
					":"+id+","+context.current.otid.formatID);
        }
    
public voidsending_reply(int id, PropagationContextHolder holder)
Pass the operation through to the CurrentTransaction class.

param
id The request identifier.
param
holder The context to be returned on the reply.
return
exception
INVALID_TRANSACTION The current transaction has outstanding work on this reply, and has been marked rollback-only, or the reply is returning when a different transaction is active from the one active when the request was imported.
exception
TRANSACTION_ROLLEDBACK The current transaction has already been rolled back.
see


        if (debug) {
			_logger.log(Level.FINE,"In sending_reply"+
					":"+id+","+holder.value.current.otid.formatID);
        }

        CurrentTransaction.sendingReply(id, holder);

        if (debug) {
			_logger.log(Level.FINE,"Out sending_reply"+
					":"+id+","+holder.value.current.otid.formatID);
        }
    
public voidsending_request(int id, PropagationContextHolder holder)
Pass the operation through to the CurrentTransaction class.

param
id The request identifier.
param
holder The completed context object.
return
exception
TRANSACTION_ROLLEDBACK The current transaction has been rolled back. The message should not be sent and TRANSACTION_ROLLEDBACK should be returned to the caller.
exception
TRANSACTION_REQUIRED There is no current transaction.
see


        if (debug) {
			_logger.log(Level.FINE,"In sending_request"+
					":"+id+","+holder.value.current.otid.formatID);
        }

        CurrentTransaction.sendingRequest(id, holder);

        if (debug) {
			_logger.log(Level.FINE,"Out sending_request"+
					":"+id+","+holder.value.current.otid.formatID);
        }