private String extractObjectId(String encodedRCData) { if (jtsLogger.logger.isDebugEnabled()) { jtsLogger.logger.debug("RecoveryCoordinatorId(" + encodedRCData + ")"); } String ObjectId2SvcCtx = null; char delimiter = '#'; boolean ok = (encodedRCData != null); if (ok) { int index1 = encodedRCData.indexOf(delimiter); int index2 = 0; if (index1 != -1) { ObjectId2SvcCtx = encodedRCData.substring(0, index1); } else ok = false; if (ok) { try { String RCDefaultObjectReference = encodedRCData.substring(index1 + 1); org.omg.CORBA.Object obj = _ourOrb.string_to_object(RCDefaultObjectReference); reco = RecoveryCoordinatorHelper.narrow(obj); } catch (Exception e) { jtsLogger.i18NLogger .warn_orbspecific_jacorb_recoverycoordinators_ClientForwardInterceptor_2(e); } } } return ObjectId2SvcCtx; }
/** * Returns the CORBA Object which represents this object. * * @param * @return The CORBA object. * @see */ final synchronized RecoveryCoordinator object() { if (thisRef == null) { if (poa == null) { poa = Configuration.getPOA("RecoveryCoordinator" /*#Frozen*/); recoverable = Configuration.isRecoverable(); } try { if (recoverable && globalTID != null) { // Create the object id from the global transaction // identifier and the internal sequence number. byte[] tidBytes = globalTID.toBytes(); byte[] id = new byte[tidBytes.length + 4]; System.arraycopy(tidBytes, 0, id, 4, tidBytes.length); id[0] = (byte) internalSeq; id[1] = (byte) (internalSeq >> 8); id[2] = (byte) (internalSeq >> 16); id[3] = (byte) (internalSeq >> 24); // Activate the object and create the reference. poa.activate_object_with_id(id, this); org.omg.CORBA.Object obj = poa.create_reference_with_id(id, RecoveryCoordinatorHelper.id()); thisRef = RecoveryCoordinatorHelper.narrow(obj); // thisRef = (RecoveryCoordinator) this; } else { poa.activate_object(this); org.omg.CORBA.Object obj = poa.servant_to_reference(this); thisRef = RecoveryCoordinatorHelper.narrow(obj); // thisRef = (RecoveryCoordinator)this; } } catch (Exception exc) { _logger.log(Level.SEVERE, "jts.create_recoverycoordinator_error"); String msg = LogFormatter.getLocalizedMessage(_logger, "jts.create_recoverycoordinator_error"); throw new org.omg.CORBA.INTERNAL(msg); } } return thisRef; }
/** Throws a ForwardRequest */ public void send_request(ClientRequestInfo ri) throws ForwardRequest { String objectIdString = null; try { RCobjectId = JavaIdlRCServiceInit._poa.reference_to_id(ri.effective_target()); objectIdString = new String(RCobjectId); if (JavaIdlRCServiceInit.RC_ID.equals(objectIdString)) { Any indicator = ri.get_slot(IndicatorSlotId); if (indicator.type().kind().equals(TCKind.tk_null)) { ri.add_request_service_context(RCctx, false); } } } catch (Exception ex) { jtsLogger.i18NLogger.warn_orbspecific_jacorb_recoverycoordinators_ClientForwardInterceptor_4( ex); } if (!in_loop) { in_loop = true; if (JavaIdlRCServiceInit.RC_ID.equals(objectIdString)) { if (ri.effective_target()._is_a(RecoveryCoordinatorHelper.id())) { /* * Extract the substring of the ObjectId that contains the Uid and * the Process Id and pass it to the data of the service context */ RCobjectId = extractObjectId(objectIdString).getBytes(StandardCharsets.UTF_8); RCctx = new ServiceContext(RecoveryContextId, RCobjectId); in_loop = false; throw new ForwardRequest(reco); } else { in_loop = false; } } in_loop = false; } }