Registers the given event, i.e. if it has a timestamp, the
timestamp boundaries will be potentially adjusted to accomodate
for inclusion of this event.

@param event Event to be registered.
4151
public void register(XEvent event) {
		Date date = XTimeExtension.instance().extractTimestamp(event);
		if(date != null) {
			register(date);
		}
	}
718899
public void register(final Object listener) {
		for (Class clazz = listener.getClass(); clazz != null; clazz = clazz.getSuperclass()) {
			Method[] methods = clazz.getMethods();
			for (Method m : methods) {
				if (!m.isAnnotationPresent(Subscribe.class)) continue;
				Class[] params = m.getParameterTypes();

				if (params.length != 1)
					throw new IllegalArgumentException("Method " + m + " has @Subscribe annotation" +
							"and requires " + params.length +
							" arguments, but event-handling methods must require just one argument");
				Class event = params[0];
				EventHandler handler = new EventHandler(listener, m);
				this.handlersByEventType.put(event, handler);
			}
		}
	}
701895
public void processEvent(EventObject event) {
    if (event instanceof RequestEvent) {
      processRequestEvent((RequestEvent) event);
    } else {
      LOG.error("invalid event type received: " + event.getClass().getName() + ": "
          + event.toString());
    }
  }
527134
public synchronized void registerSSLConfigChangeListener(SSLConfigChangeListener listener, SSLConfigChangeEvent event) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "registerSSLConfigChangeListener", new Object[] { listener, event });

        List<SSLConfigChangeListener> listenerList = sslConfigListenerMap.get(event.getAlias());

        if (listenerList != null) {
            // used to hold sslconfig -> list of listener references
            listenerList.add(listener);
            sslConfigListenerMap.put(event.getAlias(), listenerList);
        } else {
            listenerList = new ArrayList<SSLConfigChangeListener>();
            listenerList.add(listener);
            sslConfigListenerMap.put(event.getAlias(), listenerList);
        }

        // used to hold listener -> listener event references
        sslConfigListenerEventMap.put(listener, event);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "registerSSLConfigChangeListener");
    }
416123
protected void scheduleEvent(final Event event, final long delay, final long period) {
        final Timer timer = new Timer();
        timer.schedule(new ScheduleEvent().event(event), delay, period);
        timers.add(timer);
    }
17314
public static void post(final Event event) {
        if (!isEnable()) {
            return;
        }
        CopyOnWriteArraySet<Subscriber> subscribers = SUBSCRIBER_MAP.get(event.getClass());
        if (CommonUtils.isNotEmpty(subscribers)) {
            for (final Subscriber subscriber : subscribers) {
                if (subscriber.isSync()) {
                    handleEvent(subscriber, event);
                } else { // 异步
                    final RpcInternalContext context = RpcInternalContext.peekContext();
                    final ThreadPoolExecutor asyncThreadPool = AsyncRuntime.getAsyncThreadPool();
                    try {
                        asyncThreadPool.execute(
                            new Runnable() {
                                @Override
                                public void run() {
                                    try {
                                        RpcInternalContext.setContext(context);
                                        handleEvent(subscriber, event);
                                    } catch (Exception e) {
                                        RpcInternalContext.removeContext();
                                    }
                                }
                            });
                    } catch (RejectedExecutionException e) {
                        LOGGER
                            .warn("This queue is full when post event to async execute, queue size is " +
                                asyncThreadPool.getQueue().size() +
                                ", please optimize this async thread pool of eventbus.");
                    }
                }
            }
        }
    }
781096
public void register(Date date) {
		if(date != null) {
			if(first == null) {
				// initialization
				first = date;
				last = date;
			} else if(date.before(first)) {
				first = date;
			} else if(date.after(last)) {
				last = date;
			}
		}
	}
208667
public void registerEventCallback(ObjectManagerEventCallback callback)
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass, "registerEventCallback", callback);

        objectManagerState.registerEventCallback(callback);

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass, "registerEventCallback");
    }
1359585
public <E extends Event> void publish(E event) {
        if (!eventListenerMap.isEmpty()) {
            EventListener<E> eventListener = getEventListener(event);
            if (eventListener != null) {
                eventListener.on(event);
            }
        }
    }
228858
void register(Object listener) {
    Multimap<Class<?>, Subscriber> listenerMethods = findAllSubscribers(listener);

    for (Map.Entry<Class<?>, Collection<Subscriber>> entry : listenerMethods.asMap().entrySet()) {
      Class<?> eventType = entry.getKey();
      Collection<Subscriber> eventMethodsInListener = entry.getValue();

      CopyOnWriteArraySet<Subscriber> eventSubscribers = subscribers.get(eventType);

      if (eventSubscribers == null) {
        CopyOnWriteArraySet<Subscriber> newSet = new CopyOnWriteArraySet<Subscriber>();
        eventSubscribers =
            MoreObjects.firstNonNull(subscribers.putIfAbsent(eventType, newSet), newSet);
      }

      eventSubscribers.addAll(eventMethodsInListener);
    }
  }
1279253
@Override
	@SuppressWarnings({ "unchecked" })
	protected void append(final LoggingEvent event) {
		if (null == this.client) {
			try {
				connectToAerospike();
			} catch (UnknownHostException e) {
				throw new RuntimeException(e.getMessage(), e);
			}
		}
		List<Bin> binList = new ArrayList<Bin>();
		StringBuilder keyString = new StringBuilder();
		if (null != applicationId) {
			MDC.put(APP_ID, applicationId);
			keyString.append(applicationId).append(":");
			binList.add(new Bin(APP_ID, applicationId));
		}
		String eventName = event.getLogger().getName();
		binList.add(new Bin(NAME, eventName));
		keyString.append(eventName).append(":");
		binList.add(new Bin(LEVEL, event.getLevel().toString()));
		keyString.append(event.getLevel().toString()).append(":");
		Calendar tstamp = Calendar.getInstance();
		tstamp.setTimeInMillis(event.getTimeStamp());
		binList.add(new Bin(TIMESTAMP, event.getTimeStamp()));
		keyString.append(event.getTimeStamp());
		
		// Copy properties into the record
		Map<Object, Object> props = event.getProperties();
		if (null != props && props.size() > 0) {
			Map<String, String> propsMap = new HashMap<String, String>();
			for (Map.Entry<Object, Object> entry : props.entrySet()) {
				propsMap.put(entry.getKey().toString(), entry.getValue().toString());
			}
			binList.add(new Bin(PROPERTIES, propsMap));
		}

		// Copy traceback info (if there is any) into the record
		String[] traceback = event.getThrowableStrRep();
		if (null != traceback && traceback.length > 0) {
			List<String> tb = new ArrayList<String>();
			tb.addAll(Arrays.asList(traceback));
			binList.add(new Bin(TRACEBACK, tb));
		}

		// Put the rendered message into the record
		binList.add(new Bin(MESSAGE, event.getRenderedMessage()));

		// Insert a record
		Calendar now = Calendar.getInstance();
		MDC.put(YEAR, now.get(Calendar.YEAR));
		MDC.put(MONTH, String.format("%1$02d", now.get(Calendar.MONTH) + 1));
		MDC.put(DAY, String.format("%1$02d", now.get(Calendar.DAY_OF_MONTH)));
		MDC.put(HOUR, String.format("%1$02d", now.get(Calendar.HOUR_OF_DAY)));

		MDC.remove(YEAR);
		MDC.remove(MONTH);
		MDC.remove(DAY);
		MDC.remove(HOUR);
		if (null != applicationId) {
			MDC.remove(APP_ID);
		}
		Key key = new Key(this.namespace, this.set, keyString.toString());
		this.client.put(null, key, binList.toArray(new Bin[0]));
	}
297828
public void append(final T event) {

		// make sure we can append the log message

		if (backgroundService == null) {
			return;
		}

		if (!backgroundService.isRunning()) {
			return;
		}

		// skip internal logging
		
		if (!allowComDotStackify) {
			String className = eventAdapter.getClassName(event);
			
			if (className != null) {
				if (className.startsWith(COM_DOT_STACKIFY)) {
					return;
				}
			}
		}
		
		// build the log message and queue it to be sent to Stackify

		Throwable exception = eventAdapter.getThrowable(event);

		StackifyError error = null;

		if ((exception != null) || (eventAdapter.isErrorLevel(event))) {
			StackifyError e = eventAdapter.getStackifyError(event, exception);

			if (errorGovernor.errorShouldBeSent(e)) {
				error = e;
			}
		}

		LogMsg logMsg = eventAdapter.getLogMsg(event, error);

		collector.addLogMsg(logMsg);
	}
133397
public void putEvents(List<Event> events) {
        Exception lastException;
        List<EventType> eventTypes = new ArrayList<EventType>();
        for (Event event : events) {
            EventType eventType = EventMapper.map(event);
            eventTypes.add(eventType);
        }

        int i = 0;
        lastException = null;
        while (i < numberOfRetries) {
            try {
                monitoringService.putEvents(eventTypes);
                break;
            } catch (Exception e) {
                lastException = e;
                i++;
            }
            if(i < numberOfRetries) {
                try {
                    Thread.sleep(delayBetweenRetry);
                } catch (InterruptedException e) {
                    break;
                }
            }
        }

        if (i == numberOfRetries) {
            throw new MonitoringException("1104", "Could not send events to monitoring service after "
                                                  + numberOfRetries + " retries.", lastException, events);
        }
    }
1169759
@Transactional
	public void save(Event event) {
		Event merged = em.merge(event);
		em.flush();
		event.setId(merged.getId());
	}
1238164
void add(int event) {
        int b = bits.addAndGet(event);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(this, tc, "add " + event + ", polling state: " + b);
    }
93579
public void processEvent(EventObject event) {
    // Don't need to do anything except resend if challenged
    // (we only get here for a stateless NOTIFY)

    if (event instanceof ResponseEvent) {
      receivedResponses.add(new SipResponse((ResponseEvent) event));
      resendWithAuthorization((ResponseEvent) event);
    }
  }
229444
@Override
    public void registerTimeLimit(final long nanos) {
        if (timeLimitNanos.get() == -1 || timeLimitNanos.get() > nanos)
            timeLimitNanos.set(nanos);
    }