Overload {@link #emitAsync(EventObject, Object...)} for performance
tuning.
@see #emitAsync(EventObject, Object...)
544113
public EventBus emitAsync(ActEvent event, Object... args) {
        return _emitWithOnceBus(eventContextAsync(event, args));
    }
5519
function eventData(emitter) {
	return emitter[eventEmitter.EVENT_DATA_PROPERTY] || Object.defineProperty(emitter, eventEmitter.EVENT_DATA_PROPERTY, {
		value: {},
		enumerable: false
	})[eventEmitter.EVENT_DATA_PROPERTY];
}
505112
function() {
  // set the emitter
  events.EventEmitter.call(this);
  this.jobs = {};
  this.taskQ = new task.TaskQ();
  this.maxTasks = os.cpus().length;
  winston.info(_pkgname + 'max workers['+this.maxTasks+']');
}
91178
@Override
    public <T extends Throwable> T emit(T throwable, String message, long sequence, Logger logger) {
        message = message == null ? Throwables.getFullMessage(throwable) : message + ": " + Throwables.getFullMessage(throwable);
        emit(Level.WARNING, message, sequence, logger);
        return throwable;
    }
1080336
private JSONArray emitOperations(ObjectName objName) throws Exception {
        MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
        MBeanInfo mBeanInfo = mBeanServer.getMBeanInfo(objName);
        JSONArray ar = new JSONArray();

        MBeanOperationInfo[] operations = mBeanInfo.getOperations();
        for (MBeanOperationInfo operation : operations) {
            JSONObject obj = new JSONObject();
            obj.put("name", operation.getName());
            obj.put("description", operation.getDescription());
            obj.put("returnType", operation.getReturnType());
            obj.put("impact", operation.getImpact());

            JSONArray params = new JSONArray();
            for (MBeanParameterInfo param : operation.getSignature()) {
                JSONObject p = new JSONObject();
                p.put("name", param.getName());
                p.put("type", param.getType());
                params.put(p);
            }
            obj.put("params", params);
            ar.put(obj);
        }
        return ar;
    }
1347364
public static void throwCompensationEvent(List<EventSubscriptionEntity> eventSubscriptions, ActivityExecution execution, boolean async) {

    // first spawn the compensating executions
    for (EventSubscriptionEntity eventSubscription : eventSubscriptions) {
      // check whether compensating execution is already created
      // (which is the case when compensating an embedded subprocess,
      // where the compensating execution is created when leaving the subprocess
      // and holds snapshot data).
      ExecutionEntity compensatingExecution = getCompensatingExecution(eventSubscription);
      if (compensatingExecution != null) {
        if (compensatingExecution.getParent() != execution) {
          // move the compensating execution under this execution if this is not the case yet
          compensatingExecution.setParent((PvmExecutionImpl) execution);
        }

        compensatingExecution.setEventScope(false);
      } else {
        compensatingExecution = (ExecutionEntity) execution.createExecution();
        eventSubscription.setConfiguration(compensatingExecution.getId());
      }
      compensatingExecution.setConcurrent(true);
    }

    // signal compensation events in REVERSE order of their 'created' timestamp
    Collections.sort(eventSubscriptions, new Comparator<EventSubscriptionEntity>() {
      @Override
      public int compare(EventSubscriptionEntity o1, EventSubscriptionEntity o2) {
        return o2.getCreated().compareTo(o1.getCreated());
      }
    });

    for (EventSubscriptionEntity compensateEventSubscriptionEntity : eventSubscriptions) {
      compensateEventSubscriptionEntity.eventReceived(null, async);
    }
  }
162632
function syncEvent(emitters, eventName, context, callback) {
  var thisKey = '';
  var eventListener = getListener(eventName, context);
  emitters.forEach(function (item) {
    thisKey += '_' + item.constructor.name;
    item.on(eventName, eventListener);
  });
  context[thisKey] = {emittersLength: emitters.length};
  
  function getListener(eventName, context) {
    return function listener () {
      var argsKey = '_' + eventName + Array.prototype.slice.call(arguments).join('_');
      var elements = context[thisKey];
      if (typeof elements[argsKey] === 'undefined') {
        elements[argsKey] = 0;
        return;
      }
      else if (elements[argsKey] < elements.emittersLength-2){
        elements[argsKey] = elements[argsKey] + 1;
        return;
      }
      delete elements[argsKey];
      callback.apply(context, Array.prototype.slice.call(arguments));
    };
  }
}
403160
public void subscribeEvent(Object object) {
        if (object instanceof Class) {
            object = locator.createAndInitialize((Class) object);
        } else {
            locator.inject(object);
            locator.postConstruct(object);
        }
        getEventBus().subscribe(object);
    }
347396
public EventBus emitAsync(String event, Object... args) {
        return _emitWithOnceBus(eventContextAsync(event, args));
    }
475857
@JRubyMethod(optional = 1, frame = true)
    public static IRubyObject emit(IRubyObject self, IRubyObject[] _oid, Block proc) {
        Ruby runtime = self.getRuntime();
        int level = RubyNumeric.fix2int((IRubyObject)((RubyObject)self).fastGetInstanceVariable("@level")) + 1;
        ((RubyObject)self).fastSetInstanceVariable("@level", runtime.newFixnum(level));
        ThreadContext ctx = runtime.getCurrentContext();
        Emitter emitter = (Emitter)self.dataGetStructChecked();
        Extra bonus = (Extra)emitter.bonus;

        IRubyObject oid = _oid.length == 0 ? runtime.getNil() : _oid[0];
            
        bonus.oid = oid;
        IRubyObject symple;
        if(!oid.isNil() && bonus.data.callMethod(ctx, "has_key?", oid).isTrue()) {
            symple = ((RubyHash)bonus.data).op_aref(ctx, oid);
        } else {
            symple = proc.yield(ctx, (IRubyObject)((RubyObject)self).fastGetInstanceVariable("@out"));
        }
        emitter.markNode(symple);

        level--;
        ((RubyObject)self).fastSetInstanceVariable("@level", runtime.newFixnum(level));
        if(level == 0) {
            emitter.emit(symple);
            emitter.flush(0);
            return bonus.port;
        }
        return symple;
    }
364873
protected CompletionStage<Void> emitEvent(final IRI identifier, final IRI activityType, final IRI resourceType) {
        // Always notify about updates for the resource in question
        getServices().getEventService().emit(new SimpleEvent(getUrl(identifier), getSession().getAgent(),
                    asList(PROV.Activity, activityType), asList(resourceType)));
        // If this was an update and the parent is an ldp:IndirectContainer,
        // notify about the member resource (if it exists)
        if (AS.Update.equals(activityType) && LDP.IndirectContainer.equals(getParentModel())) {
            return emitMembershipUpdateEvent();
        // If this was a creation or deletion, and the parent is some form of container,
        // notify about the parent resource, too
        } else if (AS.Create.equals(activityType) || AS.Delete.equals(activityType)) {
            final IRI model = getParentModel();
            final IRI id = getParentIdentifier();
            if (HttpUtils.isContainer(model)) {
                getServices().getEventService().emit(new SimpleEvent(getUrl(id),
                                getSession().getAgent(), asList(PROV.Activity, AS.Update), asList(model)));
                // If the parent's membership resource is different than the parent itself,
                // notify about that membership resource, too (if it exists)
                if (!parent.getMembershipResource().map(MutatingLdpHandler::removeHashFragment).filter(isEqual(id))
                        .isPresent()) {
                    return allOf(getServices().getResourceService().touch(id).toCompletableFuture(),
                            emitMembershipUpdateEvent().toCompletableFuture());
                }
                return getServices().getResourceService().touch(id);
            }
        }
        return completedFuture(null);
    }
166295
public void incrementSync(String distributedObjectName, int count) {
        getOrPutIfAbsent(eventCounterMap, distributedObjectName, EVENT_COUNTER_CONSTRUCTOR_FN)
                .incrementSyncCount(count);
    }
971338
function EmitContinuation (stream) {

  stream._processing++;

  var self = function (err, data) {
    if (err)
      self.err = err;
    else if (Array.isArray(data))
      self.data = data;
    else
      self.data = [data];

    self.done = true;

    stream._processing--;

    stream._next();
  };
  return self;
}
1012215
function _Emitter() {
		var eventTarget = document.createDocumentFragment();
		["addEventListener", "dispatchEvent", "removeEventListener"].forEach(function(method) {
			if (!this[method]) this[method] = eventTarget[method].bind(eventTarget);
		}, this);
	}
278747
function on (state, eventName, handler) {
  state.emitter.on(eventName, handler)

  return state.api
}
879226
function() {
  var that = this;
  var boundEmitComplete = emitComplete.bind(this);
  
  EventEmitter.call(this);

  this.middleware = [];
  this.server = net.createServer(function(conn) {
    var buffer = '';
    var info = null;

    conn.on('data', function(data) {
      buffer += data;

      if(!info) {
        if(buffer.indexOf('\f') !== -1) {
          var split = buffer.split('\f');
          
          try {
            info = JSON.parse(split[0]);
            buffer = split[1];
          } catch(e) {
            that.emit('error', e);
          }
        }
      }

      if(buffer && info) {
        handleEntries(buffer, info, that.middleware, boundEmitComplete);
        buffer = '';
      }
    });

    conn.on('end', function() {
      that.emit('end');
    });

    conn.on('error', function(err) {
      that.emit('error', err);
    });
  });
}
1245076
function(event, data, target){
            windowManager.eventEmitter.emit(event, {
                'emittedBy': windowManager.getCurrent().name,
                'target': target,
                'data': data
            });
        }