/**
   * Destroys the RecoveryCoordinatorImpl object.
   *
   * @param
   * @return
   * @see
   */
  final synchronized void destroy() {

    try {
      if (poa != null && thisRef != null) {
        poa.deactivate_object(poa.reference_to_id(thisRef));
        thisRef = null;
      } else {
        // BUGFIX(Ram J) It is possible that the
        // RecoveryCoordinator object was activated via the activation
        // daemon. In that case, there is no guarantee
        // that poa and thisRef are set to a meaningful value.
        // So, try to deactivate the RecoveryCoordinator object anyway.

        POA rcPoa = null;
        if (poa == null) {
          rcPoa = Configuration.getPOA("RecoveryCoordinator" /*#Frozen*/);
        } else {
          rcPoa = poa;
        }

        if (thisRef == null) {
          rcPoa.deactivate_object(rcPoa.servant_to_id(this));
        } else {
          rcPoa.deactivate_object(rcPoa.reference_to_id(thisRef));
          thisRef = null;
        }
      }
    } catch (Exception exc) {
      _logger.log(Level.WARNING, "jts.object_destroy_error", "RecoveryCoordinator");
    }

    // finalize();
    globalTID = null;
    internalSeq = 0;
  }
  /**
   * 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;
  }