1 23 24 28 29 51 package com.sun.jts.CosTransactions; 52 53 import org.omg.CORBA.*; 54 import org.omg.CORBA.TSIdentificationPackage.*; 55 import org.omg.CosTransactions.*; 56 import org.omg.CosTSPortability.*; 57 58 import java.util.logging.Logger ; 59 import java.util.logging.Level ; 60 import com.sun.logging.LogDomains; 61 75 76 83 class SenderReceiver implements Sender, Receiver { 84 85 static private final boolean debug = false; 86 private static SenderReceiver sendRec = new SenderReceiver(); 87 90 static Logger _logger = LogDomains.getLogger(LogDomains.TRANSACTION_LOGGER); 91 92 101 SenderReceiver() {} 102 103 118 public void sending_request(int id, PropagationContextHolder holder) 119 throws TRANSACTION_ROLLEDBACK, TRANSACTION_REQUIRED { 120 121 if (debug) { 122 _logger.log(Level.FINE,"In sending_request"+ 123 ":"+id+","+holder.value.current.otid.formatID); 124 } 125 126 CurrentTransaction.sendingRequest(id, holder); 127 128 if (debug) { 129 _logger.log(Level.FINE,"Out sending_request"+ 130 ":"+id+","+holder.value.current.otid.formatID); 131 } 132 } 133 134 148 public void received_reply(int id, PropagationContext context, 149 org.omg.CORBA.Environment ex) 150 throws org.omg.CORBA.WrongTransaction { 151 152 if (debug) { 153 _logger.log(Level.FINE,"In received_reply"+ 154 ":"+id+","+context.current.otid.formatID); 155 } 156 157 CurrentTransaction.receivedReply(id, context, ex); 158 159 if (debug) { 160 _logger.log(Level.FINE,"Out received_reply"+ 161 ":"+id+","+context.current.otid.formatID); 162 } 163 } 164 165 175 public void received_request(int id, PropagationContext context) { 176 177 if (debug) { 178 _logger.log(Level.FINE,"In received_request"+ 179 ":"+id+","+context.current.otid.formatID); 180 } 181 182 CurrentTransaction.receivedRequest(id, context); 183 184 if (debug) { 185 _logger.log(Level.FINE,"Out received_request"+ 186 ":"+id+","+context.current.otid.formatID); 187 } 188 } 189 190 207 public void sending_reply(int id, PropagationContextHolder holder) 208 throws INVALID_TRANSACTION, TRANSACTION_ROLLEDBACK { 209 210 if (debug) { 211 _logger.log(Level.FINE,"In sending_reply"+ 212 ":"+id+","+holder.value.current.otid.formatID); 213 } 214 215 CurrentTransaction.sendingReply(id, holder); 216 217 if (debug) { 218 _logger.log(Level.FINE,"Out sending_reply"+ 219 ":"+id+","+holder.value.current.otid.formatID); 220 } 221 } 222 223 232 static void identify(TSIdentification ident) { 233 try { 234 ident.identify_sender(sendRec); 235 ident.identify_receiver(sendRec); 236 if (debug) { 237 _logger.log(Level.FINE,"Sender/Receiver "+ sendRec + 238 " successfully identified"); 239 } 240 } catch(AlreadyIdentified exc) { 241 _logger.log(Level.WARNING,"jts.already_indetified_communication_manager"); 242 } catch (NotAvailable exc) { 243 _logger.log(Level.WARNING,"jts.unable_to_indetify_communication_manager"); 244 } 245 } 246 247 private void debugMessage(String msg, int id, PropagationContext ctx) { 248 _logger.log(Level.FINE,msg+";"+id); 251 if (ctx == null) { 252 _logger.log(Level.FINE,""); 253 } else { 254 _logger.log(Level.FINE,"," + ctx.current.otid.formatID); 255 } 256 } 257 } 258 | Popular Tags |