/* (non-Javadoc)
@see org.openhealthtools.ihe.atna.auditor.sender.AuditMessageSender#sendAuditEvent(org.openhealthtools.ihe.atna.auditor.events.AuditEventMessage[])
494391
public void sendAuditEvent(AuditEventMessage[] msgs) throws Exception 
	{
        if (!EventUtils.isEmptyOrNull(msgs)) {
        	DatagramSocket socket = new DatagramSocket();
    		for (int i=0; i<msgs.length; i++) {
    			if (!EventUtils.isEmptyOrNull(msgs[i])) {
    				send(msgs[i], socket, msgs[i].getDestinationAddress(), msgs[i].getDestinationPort());
    			}
    		}
           socket.close();
        }
	}
241348
@Override
	void sendTaskEvent(TaskEvent event) throws IOException {
		checkError();
		checkState(subpartitionView != null, "Tried to send task event to producer before requesting the subpartition.");

		if (!taskEventPublisher.publish(partitionId, event)) {
			throw new IOException("Error while publishing event " + event + " to producer. The producer could not be found.");
		}
	}
610241
void triggerBasicEvent(Event.EventType type, String message)
  {
    triggerBasicEvent(type, message, false);
  }
1286998
@Override
    public void fireRemoteEvent(String eventName, Serializable eventData, Recipient... recipients) {
        Message message = new EventMessage(eventName, eventData);
        producer.publish(EventUtil.getChannelName(eventName), message, recipients);
    }
1115706
@Benchmark
  @BenchmarkMode(Mode.SampleTime)
  @OutputTimeUnit(TimeUnit.NANOSECONDS)
  public Span addMessageEvent(Data data) {
    data.span.addMessageEvent(
        io.opencensus.trace.MessageEvent.builder(Type.RECEIVED, 1)
            .setUncompressedMessageSize(3)
            .build());
    return data.span;
  }
595854
protected void sendEvent(T event, Object receiver, CreationalContext<?> creationalContext) {
        try {
            preNotify(event, receiver);
            // As we are working with the contextual instance, we may not have the
            // actual object, but a container proxy (e.g. EJB)
            notificationStrategy.invoke(receiver, observerMethod, event, beanManager, creationalContext);
        } finally {
            postNotify(event, receiver);
        }
    }
1369434
public void onInviteEvent(javax.sip.RequestEvent requestEvent,
			ActivityContextInterface aci) {

		final ServerTransaction serverTransaction = requestEvent
				.getServerTransaction();

		try {
			// send "trying" response
			Response response = messageFactory.createResponse(Response.TRYING,
					requestEvent.getRequest());
			serverTransaction.sendResponse(response);
			// get local object
			final SbbLocalObject sbbLocalObject = this.sbbContext
					.getSbbLocalObject();
			
			// send 180
			response = messageFactory.createResponse(Response.RINGING,
					requestEvent.getRequest());
			serverTransaction.sendResponse(response);

			setFinalReplySent(false);
			// set timer of 1 secs on the dialog aci to send 200 OK after that
			timerFacility.setTimer(aci, null,
					System.currentTimeMillis() + 1000L, getTimerOptions());			
						
		} catch (Exception e) {
			getTracer().severe("failure while processing initial invite", e);
		}
	}
1159069
@SuppressWarnings("UnusedReturnValue")
    public static boolean sendAccessibilityEvent(View view) {
        final AccessibilityManager accessibilityManager = (AccessibilityManager)
                view.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);

        if (!accessibilityManager.isEnabled()) return false;

        final AccessibilityEvent accessibilityEvent = AccessibilityEvent
                .obtain(AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED);
        accessibilityEvent.setClassName(view.getClass().getName());
        accessibilityEvent.setPackageName(view.getContext().getPackageName());

        view.dispatchPopulateAccessibilityEvent(accessibilityEvent);
        accessibilityManager.sendAccessibilityEvent(accessibilityEvent);

        return true;
    }
90416
@Override
    public void onMessageDelivered(MessageDeliveredEvent event) {
        for (IMessagingListener listener : messagingListeners) {
            try {
                listener.onMessageDelivered(event);
            } catch (Exception e) {
                logError(e, "message delivered "+event.getMessageId());
            }
        }
    }
419157
public void setEventStatusCodes(java.util.Collection<String> eventStatusCodes) {
        if (eventStatusCodes == null) {
            this.eventStatusCodes = null;
            return;
        }

        this.eventStatusCodes = new java.util.ArrayList<String>(eventStatusCodes);
    }
66851
public static void sendMessage (DObject speakObj, ChatMessage msg)
    {
        if (speakObj == null) {
            log.warning("Dropping speak message, no speak obj '" + msg + "'.", new Exception());
            return;
        }

        // post the message to the relevant object
        speakObj.postMessage(ChatCodes.CHAT_NOTIFICATION, new Object[] { msg });

        // if this is a user message; add it to the heard history of all users that can "hear" it
        if (!(msg instanceof UserMessage)) {
            return;

        } else if (speakObj instanceof SpeakObject) {
            _messageMapper.omgr = (RootDObjectManager)speakObj.getManager();
            _messageMapper.message = (UserMessage)msg;
            ((SpeakObject)speakObj).applyToListeners(_messageMapper);
            _messageMapper.omgr = null;
            _messageMapper.message = null;

        } else {
            log.info("Unable to note listeners", "dclass", speakObj.getClass(), "msg", msg);
        }
    }
1364178
@SuppressWarnings("unchecked")
    private void dispatchMessage(ArrayListMultimap<Integer, MessageListener> listenerMap, Message message) {
        List<MessageListener> messageListeners;

        // If the message is a Channel Message, hit the channel based listeners first.
        if (message instanceof ChannelMessage) {
            messageListeners = listenerMap.get(((ChannelMessage) message).getChannelInt());
            if (messageListeners != null) {
                for (MessageListener listener : messageListeners) {
                    listener.messageReceived(message);
                }
            }
        }

        // Then send the message to any listeners registered to all channels
        //   or to listeners for messages that do not support channels.
        messageListeners = listenerMap.get(null);
        if (messageListeners != null) {
            for (MessageListener listener : messageListeners) {
                listener.messageReceived(message);
            }
        }
    }
1123431
@Override
    public SendObjectMessage recipients(Collection<? extends ApiBaseUser> recipients) {
        for(ApiBaseUser user : recipients) {
            this.recipients.add(user.getName());
        }
        return this;
    }
503591
public void setEvents(java.util.Collection<Event> events) {
        if (events == null) {
            this.events = null;
            return;
        }

        this.events = new java.util.ArrayList<Event>(events);
    }
643675
@Override
    public void messageEventOccurred(int event,
                                     SIMPMessage msg,
                                     TransactionCommon tran)
                    throws SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "messageEventOccurred", new Object[] { new Integer(event), msg, tran });

        if (event == MessageEvents.PRE_PREPARE_TRANSACTION) //183715.1
        {
            try
            {
                eventPrecommitAdd((MessageItem) msg, tran);
            } catch (SIDiscriminatorSyntaxException e)
            {
                // No FFDC code needed

                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "messageEventOccurred", "SIResourceException " + e);
                throw new SIResourceException(e);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "messageEventOccurred");
    }
1221776
public void messageReceived (MessageEvent event)
    {
        if (CHAT_NOTIFICATION.equals(event.getName())) {
            ChatMessage msg = (ChatMessage)event.getArgs()[0];
            String localtype = getLocalType(event.getTargetOid());
            processReceivedMessage(msg, localtype);
        }
    }
87847
@SuppressWarnings("unchecked")
  public <T> Listener<T> onEvent(String event, Consumer listener) {
    Set<Consumer> listeners = eventListeners.computeIfAbsent(event, e -> new CopyOnWriteArraySet<>());
    listeners.add(listener);
    return new Listener<T>() {
      @Override
      public void accept(T event) {
        listener.accept(event);
      }
      @Override
      public void close() {
        listeners.remove(listener);
      }
    };
  }