Broadcast unavailable presence from the user's available resources to the
 recipient's available resources. Route the stanza to a remote server if
 the recipient isn't hosted locally.
168830
def send_unavailable(from, to)
      available = router.available_resources(from, to)
      stanzas = available.map {|stream| unavailable(stream.user.jid) }
      broadcast_to_available_resources(stanzas, to)
    end
598941
public static boolean isAvailable() throws Exception {
        try {
            Registry myRegistry = LocateRegistry.getRegistry("127.0.0.1", port);
            com.groupon.odo.proxylib.hostsedit.rmi.Message impl = (com.groupon.odo.proxylib.hostsedit.rmi.Message) myRegistry.lookup(SERVICE_NAME);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
604644
def respond_to_missing?(method, _include_private = false)
      if @key && _resource.respond_to?(@key) && (delegate = _resource.send(@key)) && delegate.respond_to?(method.to_s)
        true
      else
        _resource.respond_to?(method.to_s)
      end
    end
1343336
def route(stanza)
      to, from = %w[to from].map {|attr| JID.new(stanza[attr]) }
      return unless @config.allowed?(to, from)
      key = [to.domain, from.domain]

      if stream = connection_to(to, from)
        stream.write(stanza)
      elsif @pending.key?(key)
        @pending[key] << stanza
      elsif @config.s2s?(to.domain)
        @pending[key] << stanza
        Vines::Stream::Server.start(@config, to.domain, from.domain) do |stream|
          stream ? send_pending(key, stream) : return_pending(key)
          @pending.delete(key)
        end
      else
        raise StanzaErrors::RemoteServerNotFound.new(stanza, 'cancel')
      end
    end
1371677
protected void remoteInit() throws JMSException
    {
        QueueBrowserGetEnumerationQuery query = new QueueBrowserGetEnumerationQuery();
        query.setSessionId(session.getId());
        query.setBrowserId(browser.getId());
        QueueBrowserGetEnumerationResponse response = (QueueBrowserGetEnumerationResponse)transportEndpoint.blockingRequest(query);
        this.id = response.getEnumId();
        log.debug("Remote queue browser enumeration ID is "+id);
    }
1317271
protected void setUnavailable() {
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
            logger.logp(Level.FINE, CLASS_NAME, "setUnavailable", "" + this.toString()); // PK26183

        state = UNAVAILABLE_PERMANENTLY_STATE;
        evtSource.onServletUnavailableForService(getServletEvent());
    }
196431
public void accept() throws NotConnectedException, InterruptedException {
        Stanza acceptPacket = new AcceptPacket(this.session.getWorkgroupJID());
        connection.sendStanza(acceptPacket);
        // TODO: listen for a reply.
        accepted = true;
    }
148431
function () {
        var data = this._conn._data;
        if (data.length > 0 && !this._conn.paused) {
            for (var i = 0; i < data.length; i++) {
                if (data[i] !== null) {
                    var stanza, rawStanza;
                    if (data[i] === "restart") {
                        stanza = this._buildStream().tree();
                    } else {
                        stanza = data[i];
                    }
                    rawStanza = Strophe.serialize(stanza);
                    this._conn.xmlOutput(stanza);
                    this._conn.rawOutput(rawStanza);
                    this.socket.send(rawStanza);
                }
            }
            this._conn._data = [];
        }
    }
1171691
public void send(SIBusMessage sibMsg, SITransaction tranImpl)
  throws SISessionUnavailableException, SISessionDroppedException,
         SIConnectionUnavailableException, SIConnectionDroppedException,
         SIResourceException, SIConnectionLostException, SILimitExceededException,
         SIErrorException,
         SINotAuthorizedException,
         SIIncorrectCallException,
         SINotPossibleInCurrentConfigurationException
  {
    if (TraceComponent.isAnyTracingEnabled() && CoreSPIProducerSession.tc.isEntryEnabled())
      SibTr.entry(CoreSPIProducerSession.tc, "send", new Object[] { this, sibMsg, tranImpl });

    if (tranImpl != null && !((TransactionCommon)tranImpl).isAlive())
    {
      SIMPIncorrectCallException e = new SIMPIncorrectCallException(
        nls_cwsik.getFormattedMessage(
           "DELIVERY_ERROR_SIRC_16",  // TRANSACTION_SEND_USAGE_ERROR_CWSIP0093
           new Object[] { _destination },
           null) );

      e.setExceptionReason(SIRCConstants.SIRC0016_TRANSACTION_SEND_USAGE_ERROR);
      e.setExceptionInserts(new String[] {_destination.getName()});

      if (TraceComponent.isAnyTracingEnabled() && TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
        SibTr.exception(tc, e);

      if (TraceComponent.isAnyTracingEnabled() && CoreSPIProducerSession.tc.isEntryEnabled())
        SibTr.exit(CoreSPIProducerSession.tc, "send", e);

      throw e;
    }
    synchronized (this)
    {
      checkNotClosed();

      // Ensure that the destination is put enabled
      if (!_destination.isSendAllowed())
      {
        if (TraceComponent.isAnyTracingEnabled() && CoreSPIProducerSession.tc.isEntryEnabled())
          SibTr.exit(CoreSPIProducerSession.tc, "send", "Destination is send disabled");

        SIMPNotPossibleInCurrentConfigurationException e = new SIMPNotPossibleInCurrentConfigurationException(
          nls_cwsik.getFormattedMessage(
            "DELIVERY_ERROR_SIRC_17", // DESTINATION_LOCKED_ERROR_CWSIP0232
            new Object[] { _destination.getName(),
                           _messageProcessor.getMessagingEngineName() },
            null));

        e.setExceptionReason(SIRCConstants.SIRC0017_DESTINATION_LOCKED_ERROR);
        e.setExceptionInserts(new String[] { _destination.getName(),
                                      _messageProcessor.getMessagingEngineName() });
        throw e;
      }

      // Extract the message
      JsMessage msg = null;
      try
      {
        msg = ((JsMessage) sibMsg).getSent(_conn.getMessageCopiedWhenSent());
      }
      catch (MessageCopyFailedException e)
      {
        FFDCFilter.processException(
          e,
          "com.ibm.ws.sib.processor.impl.ProducerSessionImpl.send",
          "1:379:1.217",
          this);

        SibTr.exception(tc, e);
        SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
          new Object[] {
            "com.ibm.ws.sib.processor.impl.ProducerSessionImpl",
            "1:386:1.217",
            e });

        if (TraceComponent.isAnyTracingEnabled() && CoreSPIProducerSession.tc.isEntryEnabled())
          SibTr.exit(CoreSPIProducerSession.tc, "send", "Could not make a safe copy of message");

        SIMPErrorException ex = new SIMPErrorException(
          nls.getFormattedMessage(
            "INTERNAL_MESSAGING_ERROR_CWSIP0002",
            new Object[] {
              "com.ibm.ws.sib.processor.impl.ProducerSessionImpl",
              "1:397:1.217",
              e },
            null),
          e);

        ex.setExceptionReason(SIRCConstants.SIRC0901_INTERNAL_MESSAGING_ERROR);
        ex.setExceptionInserts(new String[] {
          "com.ibm.ws.sib.processor.impl.ProducerSessionImpl",
          "1:405:1.217",
          SIMPUtils.getStackTrace(e)});
        throw ex;
      }
      
      // Unless otherwise specified (mediations, PubSub bridge and MQLink), clear out
      // any fingerprints already in the message to prevent accidental 'loop' detection
      // occuring.
      if(_clearPubSubFingerprints)
      {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
          SibTr.debug(this, tc, "clearFingerprints");
        msg.clearFingerprints();
      }

      // On entry to Message Processor trace the message content
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(this, tc, "verboseMsg IN : " + msg.toVerboseString());

      // Set the RFH2 allowed flag (for messages destined for MQ)
      if (_destination.isAlias() ||
          _destination.isForeign() ||
          _destination.isForeignBus())
      {
        setRFH2Allowed(msg, _destination);
      }

      // Set the message put time if required
      if (msg.getTimestamp().longValue() == SIMPConstants.TIMESTAMP_REQUIRED)
      {
        msg.setTimestamp(System.currentTimeMillis());
      }

      // If security is enabled then we'll do the discriminator access check
      if(_conn.isBusSecure())
      {
        // If pubsub, then we need to check access to the discriminator
        // And if the discriminator access was checked at create time, then
        // we need to set the discriminator into the message.
        if(_checkDiscriminatorAccessAtSend)
        {
          // set the discriminator into the security context
          _securityContext.setDiscriminator(msg.getDiscriminator());
          if(!_destination.
              checkDiscriminatorAccess(_securityContext,
                                       OperationType.SEND))
          {
            if (TraceComponent.isAnyTracingEnabled() && CoreSPIProducerSession.tc.isEntryEnabled())
              SibTr.exit(CoreSPIProducerSession.tc, "send", "not authorized to produce to this destination's discriminator");

            // Write an audit record if access is denied
            SibTr.audit(tc, nls_cwsik.getFormattedMessage(
              "DELIVERY_ERROR_SIRC_20", // USER_NOT_AUTH_SEND_ERROR_CWSIP0308
              new Object[] { _destination.getName(),
                             msg.getDiscriminator(),
                             _conn.getResolvedUserid() },
              null));

            // Thrown if user denied access to destination
            SIMPNotAuthorizedException e = new SIMPNotAuthorizedException(
              nls_cwsik.getFormattedMessage(
                "DELIVERY_ERROR_SIRC_20", // USER_NOT_AUTH_SEND_ERROR_CWSIP0308
              new Object[] { _destination.getName(),
                             msg.getDiscriminator(),
                             _conn.getResolvedUserid() },
              null));

            e.setExceptionReason(SIRCConstants.SIRC0020_USER_NOT_AUTH_SEND_ERROR);
            e.setExceptionInserts(new String[] { _destination.getName(),
                                                  msg.getDiscriminator(),
                                                  _conn.getResolvedUserid() });
            throw e;
          }
        }
        else // Access was checked at session creation time
        {
          // set the stored discriminator into the message
          msg.setDiscriminator(_discriminatorAtCreate);
        }
      }

      // Set the userid associated with the connection into the message
      // unless the sender has alternate user privilege - in which case
      // the alternate userid will be set into the message
      if(_securityContext != null &&
         _securityContext.isAlternateUserBased())
      {
        // Set the alternate user into the message
        if(!_keepSecurityUserid)
        {
          _messageProcessor.
            getAccessChecker().
            setSecurityIDInMessage(_securityContext.getAlternateUser(),msg);
        }
      }
      else
      {
        // Set the userid associated with the connection into the message
        if(!_keepSecurityUserid)
        {
          _messageProcessor.
            getAccessChecker().
            setSecurityIDInMessage(_conn.getSecuritySubject(),msg);
        }
      }

  
     
    
      //Create a message item.  If the message has come from a mediation it
      //has a message wait time in it from its time before the mediation
      //and this must be maintained, otherwise 0 can be assumed and this
      //saves having to read the waittime from the JsMessage, which is
      //fairly expensive to do performance wise.
      MessageItem item = null;


      item = new MessageItem(msg, 0L);

      // Mark this message to indicate if local queue points are preferred over others
      item.setPreferLocal(_preferLocal);

      if(_destination.isPubSub())
      {
        //defect 278038:
        //Set the connectionUuid to this connection (for durable subs noLocal matching)
        //The field will be set in the jsMsg when the msgitem is persisted or
        //when the jsMsg is sent over the wire.
        item.setProducerConnectionUuid(_conn.getUuid());
      }
      item.setProducerSeed(++_seed);

      //-----199744------------------------
      //If no message priority has been set in thes message, the default is taken
      //from the destination.  This cannot be the case for JMS messages, as JMS
      //always sets a default of 4 itself, however for non JMS messages it does
      //have a use.
      if (item.getPriority() == -1)
      {
        item.setPriority(_destination.getDefaultPriority());
      }

      if (!_destination.isOverrideOfQOSByProducerAllowed())
      {
        item.setReliability(_destination.getDefaultReliability());
      }

        // Indicate that this message requires a new SystemId
        item.setRequiresNewId(true);

      TransactionCommon transaction = null;

      if (tranImpl != null)
      {
        transaction = (TransactionCommon) tranImpl;
      }
      else
      {
        transaction = _autoCommitTransaction;
      }

      //Inidcates whether the send was a sucess, used for the rm unblock call
      boolean sucessful = false;
      Object rmCallBackObject = null;

      try
      {

        if (TraceComponent.isAnyTracingEnabled() && UserTrace.tc_mt.isDebugEnabled())
          traceSend(item, tranImpl);

        // We need to know if the FRP in the message came from an app or a
        // destination's FRP. As this is the point of entry from an app it's
        // the best place to look.
        boolean msgFRP = false;
        if(!msg.isForwardRoutingPathEmpty())
          msgFRP = true;

        _inputHandler.handleProducerMessage(item,
                                    transaction,
                                    _address,
                                    this, // If mediated, don't use us as context across messages
                                    msgFRP);

        sucessful = true;
      }
      catch(SIMPNoLocalisationsException e)
      {
        // No FFDC code needed

        // We can't find a suitable localisation.
        // Although a queue must have at least one localisation this is
        // possible if the sender restricted the potential localisations
        // using a fixed ME or a scoping alias (to an out-of-date set of
        // localisation)
      
    	
        
        if (TraceComponent.isAnyTracingEnabled() && CoreSPIProducerSession.tc.isEntryEnabled())
          SibTr.exit(CoreSPIProducerSession.tc, "send", "SINotPossibleInCurrentConfigurationException");

        SIMPNotPossibleInCurrentConfigurationException ee =
          new SIMPNotPossibleInCurrentConfigurationException(e);
        ee.setExceptionReason(SIRCConstants.SIRC0026_NO_LOCALISATIONS_FOUND_ERROR);
        ee.setExceptionInserts(new String[] { _destination.getName() });
        throw ee;
      }
     
    }//end sync

    if (TraceComponent.isAnyTracingEnabled() && CoreSPIProducerSession.tc.isEntryEnabled())
      SibTr.exit(CoreSPIProducerSession.tc, "send");
  }
710621
public synchronized Presence leave()
                    throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException, MucNotJoinedException {
        //  Note that this method is intentionally not guarded by
        // "if  (!joined) return" because it should be always be possible to leave the room in case the instance's
        // state does not reflect the actual state.

        // Reset occupant information first so that we are assume that we left the room even if sendStanza() would
        // throw.
        userHasLeft();

        final EntityFullJid myRoomJid = this.myRoomJid;
        if (myRoomJid == null) {
            throw new MucNotJoinedException(this);
        }

        // We leave a room by sending a presence packet where the "to"
        // field is in the form "roomName@service/nickname"
        Presence leavePresence = new Presence(Presence.Type.unavailable);
        leavePresence.setTo(myRoomJid);

        StanzaFilter reflectedLeavePresenceFilter = new AndFilter(
                        StanzaTypeFilter.PRESENCE,
                        new StanzaIdFilter(leavePresence),
                        new OrFilter(
                                        new AndFilter(FromMatchesFilter.createFull(myRoomJid), PresenceTypeFilter.UNAVAILABLE, MUCUserStatusCodeFilter.STATUS_110_PRESENCE_TO_SELF),
                                        new AndFilter(fromRoomFilter, PresenceTypeFilter.ERROR)
                                    )
                                );

        Presence reflectedLeavePresence = connection.createStanzaCollectorAndSend(reflectedLeavePresenceFilter, leavePresence).nextResultOrThrow();

        return reflectedLeavePresence;
    }
1253560
function execute(context, action) {
    if (!remote) return fail(context, "Not connected to a server");
    
    // prepare source path
    if (context.args.length < 1) return fail(context, "Remote path missing");
    var path = remote.join(remotePath, context.args[0]);
    action(path);
}
886777
def secondary_status
      session.cluster.with_secondary do |secondary|
        secondary.command(:admin, replSetGetStatus: 1)
      end
    rescue => e
      raise ConnectionFailed, e
    end
1042988
def publish(self, message, routing_key=None):
        
        if routing_key is None:
            routing_key = self.routing_key
        return self.client.publish_to_exchange(self.name, message=message, routing_key=routing_key)
544607
def check_incoming(self, message, addr, protocol):
        
        component = protocol.local_candidate.component

        # find remote candidate
        remote_candidate = None
        for c in self._remote_candidates:
            if c.host == addr[0] and c.port == addr[1]:
                remote_candidate = c
                assert remote_candidate.component == component
                break
        if remote_candidate is None:
            # 7.2.1.3. Learning Peer Reflexive Candidates
            remote_candidate = Candidate(
                foundation=random_string(10),
                component=component,
                transport='udp',
                priority=message.attributes['PRIORITY'],
                host=addr[0],
                port=addr[1],
                type='prflx')
            self._remote_candidates.append(remote_candidate)
            self.__log_info('Discovered peer reflexive candidate %s', remote_candidate)

        # find pair
        pair = self._find_pair(protocol, remote_candidate)
        if pair is None:
            pair = CandidatePair(protocol, remote_candidate)
            pair.state = CandidatePair.State.WAITING
            self._check_list.append(pair)
            self.sort_check_list()

        # triggered check
        if pair.state in [CandidatePair.State.WAITING, CandidatePair.State.FAILED]:
            pair.handle = asyncio.ensure_future(self.check_start(pair))

        # 7.2.1.5. Updating the Nominated Flag
        if 'USE-CANDIDATE' in message.attributes and not self.ice_controlling:
            pair.remote_nominated = True

            if pair.state == CandidatePair.State.SUCCEEDED:
                pair.nominated = True
                self.check_complete(pair)
313016
private void triggerContentEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc) throws NotConnectedException, InterruptedException {

        // Let the session know that we've established a content/media segment.
        JingleSession session = getSession();
        if (session != null) {
            List<JingleListener> listeners = session.getListenersList();
            for (JingleListener li : listeners) {
                if (li instanceof JingleSessionListener) {
                    JingleSessionListener sli = (JingleSessionListener) li;
                    sli.sessionEstablished(pt, rc, lc, session);
                }
            }
        }

        // Create a media session for each media manager in the session.
        if (mediaNeg.getMediaManager() != null) {
            rc.removeCandidateEcho();
            lc.removeCandidateEcho();

            jingleMediaSession = getMediaNegotiator().getMediaManager().createMediaSession(pt, rc, lc, session);
            jingleMediaSession.addMediaReceivedListener(session);
            if (jingleMediaSession != null) {

                jingleMediaSession.startTransmit();
                jingleMediaSession.startReceive();

                for (TransportCandidate candidate : getTransportNegotiator().getOfferedCandidates())
                    candidate.removeCandidateEcho();
            }
            JingleMediaManager mediaManager = getMediaNegotiator().getMediaManager();
            getSession().addJingleMediaSession(mediaManager.getName(), jingleMediaSession);
        }

    }
260959
def _subscribe(self):
        
        cmd = MAGIC + SUBSCRIBE + self._mac \
            + PADDING_1 + self._mac_reversed + PADDING_1
        status = self._udp_transact(cmd, self._subscribe_resp)
        if status is not None:
            self.last_subscribed = time.time()
            return status == ON
        else:
            raise S20Exception(
                "No status could be found for {}".format(self.host))
529277
function ServiceNotAvailable(message, code_id) {
    Error.call(this);
    this.message = message || "underlying service not available";
    this.code_id = code_id || null;
    this.statusCode = 503;
}