shows how to trace a blocking receive of a message
500245
private void receiveMessage() {
		MessagingSystemInfo messagingSystemInfo = oneAgentSdk.createMessagingSystemInfo("DynatraceSample", "theQueue", MessageDestinationType.QUEUE, ChannelType.IN_PROCESS, null);
		IncomingMessageReceiveTracer incomingMessageReceiveTracer = oneAgentSdk.traceIncomingMessageReceive(messagingSystemInfo);
		incomingMessageReceiveTracer.start();
		try {
			Message msg = queueManager.receive("theQeue");
			if (msg == null) {
				return; // no message received
			}
			IncomingMessageProcessTracer incomingMessageProcessTracer = oneAgentSdk.traceIncomingMessageProcess(messagingSystemInfo);
			// store incoming tag to tracer:
			incomingMessageProcessTracer.setDynatraceStringTag(msg.getProperty(OneAgentSDK.DYNATRACE_MESSAGE_PROPERTYNAME));
			incomingMessageProcessTracer.setVendorMessageId(msg.getVendorMessageId());
						incomingMessageProcessTracer.start();
			try {
				// do something with the message ...
				System.out.println("Message received: " + msg.toString());
			} catch (Exception e) {
				incomingMessageProcessTracer.error(e);
			} finally {
				incomingMessageProcessTracer.end();
			}
			
			
		} catch (Exception e) {
			incomingMessageReceiveTracer.error(e);
		} finally {
			incomingMessageReceiveTracer.end();
		}
	}
363725
public void trace(Object message, Throwable t) {
        logger.trace(String.valueOf(message), t);
    }
794093
def _trace (frame, event, arg):
    """"""
    if event in ('call', 'c_call'):
        _trace_line(frame, event, arg)
    elif event in ('return', 'c_return'):
        _trace_line(frame, event, arg)
        print("  return:", arg)
    #elif event in ('exception', 'c_exception'):
    #    _trace_line(frame, event, arg)
    return _trace
17
def trace(fout=None, format=None, byteorder=sys.byteorder, nanosecond=False):
    
    str_check(fout or '', format or '')
    return TraceFlow(fout=fout, format=format, byteorder=byteorder, nanosecond=nanosecond)
942697
public void trace( String msg, Throwable t )
    {
        if( m_delegate.isTraceEnabled() )
        {
            m_delegate.trace( msg, t );
        }
    }
34211
def receive_message(self, msg):
        """"""
        _LOGGER.debug('Starting X10Device.receive_message')
        if hasattr(msg, 'isack') and msg.isack:
            _LOGGER.debug('Got Message ACK')
            if self._send_msg_lock.locked():
                self._send_msg_lock.release()
        callbacks = self._message_callbacks.get_callbacks_from_message(msg)
        _LOGGER.debug('Found %d callbacks for msg %s', len(callbacks), msg)
        for callback in callbacks:
            _LOGGER.debug('Scheduling msg callback: %s', callback)
            self._plm.loop.call_soon(callback, msg)
        self._last_communication_received = datetime.datetime.now()
        _LOGGER.debug('Ending Device.receive_message')
271087
def _handle_watch_message(self, message):
        
        if self.log_protocol_level is not None:
            logger.log(self.log_protocol_level, "<- %s", hexlify(message).decode())
        message = self.pending_bytes + message

        while len(message) >= 4:
            try:
                packet, length = PebblePacket.parse_message(message)
            except IncompleteMessage:
                self.pending_bytes = message
                break
            except:
                # At this point we've failed to deconstruct the message via normal means, but we don't want to end
                # up permanently desynced (because we wiped a partial message), nor do we want to get stuck (because
                # we didn't wipe anything). We therefore parse the packet length manually and skip ahead that far.
                # If the expected length is 0, we wipe everything to ensure forward motion (but we are quite probably
                # screwed).
                expected_length, = struct.unpack('!H', message[:2])
                if expected_length == 0:
                    self.pending_bytes = b''
                else:
                    self.pending_bytes = message[expected_length + 4:]
                raise

            self.event_handler.broadcast_event("raw_inbound", message[:length])
            if self.log_packet_level is not None:
                logger.log(self.log_packet_level, "<- %s", packet)
            message = message[length:]
            self.event_handler.broadcast_event((_EventType.Watch, type(packet)), packet)
            if length == 0:
                break
        self.pending_bytes = message
952789
def data_received(self, framed_message):
        ''''''
        if self.verbosity >= 4:
            self.logger.debug(f'Received framed message {framed_message}')
        self.recv_size += len(framed_message)
        self.bump_cost(len(framed_message) * self.bw_cost_per_byte)
        self.framer.received_bytes(framed_message)
1347566
def get_command(self):
        
        try:
            message_bytes = self.socket.recv(zmq.NOBLOCK)
            log.debug("Received message: %r", message_bytes)
        except zmq.ZMQError as exc:
            if exc.errno == zmq.EAGAIN:
                return None
            else:
                raise
        else:
            return message_bytes.decode(config.CODEC)
584070
def on_connection_blocked(self, method_frame):
        
        LOGGER.warning('Connection blocked: %s', method_frame)
        self.state = self.STATE_BLOCKED
        if self.on_unavailable:
            self.on_unavailable(self)
359439
function trace(message) {
    var logger = State.logger || console;
    if (!this.root().trace || !logger) { return; }
    logger.info(message);
  }
157868
def recv(self):
        """"""
        LOGGER.debug('Receiving')
        try:
            message_length = struct.unpack('>i', self._socket.recv(4))[0]
            message_length -= Connection.COMM_LENGTH
            LOGGER.debug('Length: %i', message_length)
        except socket.timeout:
            return None
        
        comm_status = struct.unpack('>i', self._socket.recv(4))[0]
        LOGGER.debug('Status: %i', comm_status)
        bytes_received = 0
        message = b""
        
        while bytes_received < message_length:
            if message_length - bytes_received >= 1024:
                recv_len = 1024
            else:
                recv_len = message_length - bytes_received
            bytes_received += recv_len
            LOGGER.debug('Received %i', bytes_received)
            message += self._socket.recv(recv_len)
        
        if comm_status == 0:
            message = self._crypt.decrypt(message)
        else:
            return Message(len(message), Connection.COMM_ERROR, message)
        
        msg = Message(message_length, comm_status, message)

        return msg
15210
def _message_received(self, message):
        """"""
        with self.lock:
            self._state.receive_message(message)
            for callable in chain(self._on_message_received, self._on_message):
                callable(message)
455855
def _process_outgoing_msg(self, sink_iter):
        
        LOG.debug('NetworkController processing outgoing request list.')
        # TODO(PH): We should try not to sent routes from bgp peer that is not
        # in established state.
        from ryu.services.protocols.bgp.model import (
            FlexinetOutgoingRoute)
        while self.is_connected:
            # sink iter is Sink instance and next is blocking so this isn't
            # active wait.
            for outgoing_msg in sink_iter:
                if not self.is_connected:
                    self._socket.close()
                    return
                if isinstance(outgoing_msg, FlexinetOutgoingRoute):
                    rpc_msg = _create_prefix_notification(outgoing_msg, self)
                else:
                    raise NotImplementedError(
                        'Do not handle out going message of type %s' %
                        outgoing_msg.__class__)
                if rpc_msg:
                    self._sendall(rpc_msg)
            self.pause(0)

        # Stop incoming connection.
        if self.green_in:
            self.green_in.kill()
357794
def _wet_message_received(self, msg):
        """"""
        for callback in self._dry_wet_callbacks:
            callback(LeakSensorState.WET)
        self._update_subscribers(0x13)
1291200
def _async_recv(self):
        """"""

        logging.info("Receive loop started")
        recbuffer = b""

        while not self._stop_event.is_set():
            time.sleep(0.01)
            try:
                recbuffer = recbuffer + self._socket.recv(1024)
                data = recbuffer.split(b'\r\n')
                recbuffer = data.pop()
                if data:
                    for line in data:
                        self._process_data(line.decode(encoding='UTF-8', errors='ignore'))
            except BlockingIOError as e:
                pass
        logging.info("Receive loop stopped")
456952
function () {
    const oThis = this;

    process.on('SIGINT', function () {
      logger.info("Received SIGINT, cancelling block scaning");
      oThis.interruptSignalObtained = true;
    });
    process.on('SIGTERM', function () {
      logger.info("Received SIGTERM, cancelling block scaning");
      oThis.interruptSignalObtained = true;
    });
  }