Run IO loops on the given {@link EventLoopGroup}.

@param eventLoopGroup an eventLoopGroup to share

@return a new {@link UdpServer}
356650
public final UdpServer runOn(EventLoopGroup eventLoopGroup) {
		Objects.requireNonNull(eventLoopGroup, "eventLoopGroup");
		return runOn(preferNative -> eventLoopGroup);
	}
850125
public DnsAddressEndpointGroup build() {
        return new DnsAddressEndpointGroup(eventLoop(), minTtl(), maxTtl(),
                                           serverAddressStreamProvider(), backoff(),
                                           resolvedAddressTypes, hostname(), port);
    }
885057
public synchronized EventScope<T> register(final Class<? extends T> eventClass, final Object receiver) {

		return this.register(eventClass, receiver, (Pattern) null);

	}
491415
public DnsTextEndpointGroup build() {
        return new DnsTextEndpointGroup(eventLoop(), minTtl(), maxTtl(),
                                        serverAddressStreamProvider(),
                                        backoff(), hostname(), mapping);
    }
90891
function _loop(i) {
				var eventName = eventNames[i];
				var actionGroup = instructions[eventName];

				ws.addEventListener(eventName, function (res) {

					processActionGroup({ res: res, actionGroup: actionGroup });

					// TODO handle sending messages
				});
			}
287129
private EventLoopPool getOrCreateEventLoopPool(EventLoop eventLoop) {
        final EventLoopPool pool = eventLoopPools.get(eventLoop);
        if (pool != null) {
            return pool;
        }
        return eventLoopPools.computeIfAbsent(eventLoop, e -> new EventLoopPool());
    }
715930
public OperationFuture<List<Server>> createSnapshot(Integer expirationDays, Group... groups) {
        return serverService().createSnapshot(
            expirationDays,
            getServerSearchCriteria(groups)
        );
    }
284839
private boolean scheduleRolloutGroup(final JpaRollout rollout, final JpaRolloutGroup group) {
        final long targetsInGroup = rolloutTargetGroupRepository.countByRolloutGroup(group);
        final long countOfActions = actionRepository.countByRolloutAndRolloutGroup(rollout, group);

        long actionsLeft = targetsInGroup - countOfActions;
        if (actionsLeft > 0) {
            actionsLeft -= createActionsForRolloutGroup(rollout, group);
        }

        if (actionsLeft <= 0) {
            group.setStatus(RolloutGroupStatus.SCHEDULED);
            rolloutGroupRepository.save(group);
            return true;
        }
        return false;
    }
278875
public static LocalFsClient create(Eventloop eventloop, Path storageDir, Object lock) {
		return new LocalFsClient(eventloop, storageDir, Executors.newSingleThreadExecutor(), lock);
	}
255002
public static <T> LatchedObserver<T> create(Action1<? super T> onNext, CountDownLatch latch) {
        return new LatchedObserverImpl<T>(onNext, Functionals.emptyThrowable(), Functionals.empty(), latch);
    }
393431
public static ServerSentEvent withEventId(ByteBuf eventId, ByteBuf data) {
        return new ServerSentEvent(eventId, null, data);
    }
705202
public static base_response update(nitro_service client, clusternodegroup resource) throws Exception {
		clusternodegroup updateresource = new clusternodegroup();
		updateresource.name = resource.name;
		updateresource.strict = resource.strict;
		return updateresource.update_resource(client);
	}
1210327
public final UdpServer doOnUnbound(Consumer<? super Connection> doOnUnbound) {
		Objects.requireNonNull(doOnUnbound, "doOnUnbound");
		return new UdpServerDoOn(this, null, null, doOnUnbound);
	}
866429
@SuppressWarnings("resource")
  @Override public void run() {
    // No multicast?  Then do not bother with listening for them
    if (H2O.isFlatfileEnabled()) return;
    Thread.currentThread().setPriority(Thread.MAX_PRIORITY);

    MulticastSocket sock = null, errsock = null;
    InetAddress group = null, errgroup = null;
    boolean saw_error = false;

    // Loop forever accepting Cloud Management requests
    while( true ) {
      try {
        // ---
        // Cleanup from any prior socket failures.  Rare unless we're really sick.
        if( errsock != null && errgroup != null ) { // socket error AND group present
          final InetAddress tmp = errgroup; errgroup = null;
          errsock.leaveGroup(tmp); // Could throw, but errgroup cleared for next pass
        }
        if( errsock != null ) { // One time attempt a socket close
          final MulticastSocket tmp2 = errsock; errsock = null;
          tmp2.close();       // Could throw, but errsock cleared for next pass
        }
        if( saw_error ) Thread.sleep(1000); // prevent deny-of-service endless socket-creates
        saw_error = false;

        // ---
        // Actually do the common-case setup of Inet multicast group
        if( group == null ) group = H2O.CLOUD_MULTICAST_GROUP;
        // More common-case setup of a MultiCast socket
        if( sock == null ) {
          sock = new MulticastSocket(H2O.CLOUD_MULTICAST_PORT);
          if( H2O.CLOUD_MULTICAST_IF != null ) {
            try { 
              sock.setNetworkInterface(H2O.CLOUD_MULTICAST_IF);
            } catch( SocketException e ) {
              Log.err("Exception calling setNetworkInterface, Multicast Interface, Group, Port - "+
                      H2O.CLOUD_MULTICAST_IF+" "+H2O.CLOUD_MULTICAST_GROUP+":"+H2O.CLOUD_MULTICAST_PORT, e);
              throw e;
            }
          }
          sock.joinGroup(group);
        }

        // Receive a packet & handle it
        byte[] buf = new byte[AutoBuffer.MTU];
        DatagramPacket pack = new DatagramPacket(buf,buf.length);
        sock.receive(pack);
        TCPReceiverThread.basic_packet_handling(new AutoBuffer(pack));
      } catch( SocketException e ) {
        // This rethrow will not be caught and thus kills the multi-cast thread.
        Log.err("Turning off multicast, which will disable further cloud building");
        throw new RuntimeException(e);
      } catch( Exception e ) {
        Log.err("Exception on Multicast Interface, Group, Port - "+
          H2O.CLOUD_MULTICAST_IF+" "+H2O.CLOUD_MULTICAST_GROUP+":"+H2O.CLOUD_MULTICAST_PORT, e);
        // On any error from anybody, close all sockets & re-open
        saw_error = true;
        errsock  = sock ;  sock  = null; // Signal error recovery on the next loop
        errgroup = group;  group = null;
      }
    }
  }
504541
private OperationFuture<Group> createServers(GroupHierarchyConfig config, String rootGroupId) {
        List<CreateServerConfig> configs = config.getServerConfigs();

        List<JobFuture> futures = configs.stream()
            .map(serverConfig -> serverService().create(serverConfig).jobFuture())
            .collect(toList());

        return new OperationFuture<>(Group.refById(rootGroupId), new ParallelJobsFuture(futures));
    }
351022
private void modifyDatastreamControlGroupAction(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String actionLabel = "modifying datastream control group";

        Context context =
                ReadOnlyContext.getContext(Constants.HTTP_REQUEST.REST.uri,
                                           request);
        if (m_server == null) {
            throw new InternalError500Exception(request,
                                                actionLabel,
                                                "server not available",
                                                EMPTY_STRING_ARRAY);
        }
        // FIXME: see FCREPO-765 Admin methods are currently in DefaultManagement and carried through to ManagementModule
        ManagementModule apimDefault = (ManagementModule) m_server.getModule("org.fcrepo.server.management.Management");

        // FIXME: see FCREPO-765. tidy up output writing

        // get parameters
        String pid = request.getParameter("pid");
        String dsID = request.getParameter("dsID");
        String controlGroup = request.getParameter("controlGroup");
        boolean addXMLHeader = getParameterAsBoolean(request, "addXMLHeader", false);
        boolean reformat = getParameterAsBoolean(request, "reformat", false);
        boolean setMIMETypeCharset = getParameterAsBoolean(request, "setMIMETypeCharset", false);

        // get datastream list (single ds id is a list of one)
        String[] datastreams = dsID.split(",");

        // get iterable for pid looping
        boolean singlePID;
        Iterable<String> pids = null;
        if (pid.startsWith(PROTOCOL_FILE)) {
            File pidFile = new File(pid.substring(PROTOCOL_FILE.length()));
            pids = new PIDStreamIterableWrapper(new FileInputStream(pidFile));
            singlePID = false;

        } else { // pid list
            String[] pidList = pid.split(",");
            pids = new ArrayList<String>(Arrays.asList(pidList));
            singlePID = (pidList.length == 1);
        }

        try {

            response.setStatus(HttpServletResponse.SC_OK);
            response.setCharacterEncoding("UTF-8");

            PrintWriter pw = response.getWriter();

            // if doing a single pid/datastream, simple xml output
            if (singlePID && datastreams.length == 1) {
                response.setContentType("text/xml; charset=UTF-8");
                Date[] versions = apimDefault.modifyDatastreamControlGroup(context, pid, dsID, controlGroup, addXMLHeader, reformat, setMIMETypeCharset);
                pw.write("<versions>\n");
                    for (Date version : versions) {
                        pw.write("<version>" + version.toString() + "</version>\n");
                    }
                pw.write("</versions>\n");

            } else { // logging style output
                response.setContentType("text/plain; charset=UTF-8");
                ServerUtilitySerializer ser = new ServerUtilitySerializer(pw);
                for (String curpid : pids) {
                    ser.startObject(curpid);
                    for (String curdsID : datastreams) {
                        ser.startDatastream(curdsID);
                        Date[] versions;
                        try {
                            versions = apimDefault.modifyDatastreamControlGroup(context, curpid, curdsID, controlGroup, addXMLHeader, reformat, setMIMETypeCharset);
                        } catch (DatastreamNotFoundException e) {
                            versions = null;
                        }
                        ser.writeVersions(versions);
                        ser.endDatastream();
                    }
                    ser.endObject();
                }

                ser.finish();
            }
            pw.flush();


        } catch (ObjectNotFoundException e) {
            logger.error("Object not found: " + pid + " - " + e.getMessage());
            throw new NotFound404Exception(request,
                                           actionLabel,
                                           e.getMessage(),
                                           EMPTY_STRING_ARRAY);
        } catch (DatastreamNotFoundException e) {
            logger.error("Datastream not found: " + pid + "/" + dsID + " - " + e.getMessage());
            throw new NotFound404Exception(request,
                                           actionLabel,
                                           e.getMessage(),
                                           EMPTY_STRING_ARRAY);


        } catch (GeneralException e) {
            logger.error(e.getMessage());
            throw new InternalError500Exception(request,
                                                actionLabel,
                                                e.getMessage(),
                                                EMPTY_STRING_ARRAY);
        } catch (AuthzOperationalException aoe) {
            throw new Forbidden403Exception(request,
                                            actionLabel,
                                            "authorization failed",
                                            EMPTY_STRING_ARRAY);
        } catch (AuthzDeniedException ade) {
            throw new Forbidden403Exception(request,
                                            actionLabel,
                                            "authorization denied",
                                            EMPTY_STRING_ARRAY);
        } catch (AuthzPermittedException ape) {
            throw new Continue100Exception(request,
                                           actionLabel,
                                           "authorization permitted",
                                           EMPTY_STRING_ARRAY);

        } catch (ServerException e) {
            logger.error(e.getMessage(),e);
            throw new InternalError500Exception(request,
                                                actionLabel,
                                                "Unexpected error: " + e.getMessage(),
                                                EMPTY_STRING_ARRAY);
        }

    }
1207600
public static EventLoopGroup newEventLoopGroup(int numThreads, String threadNamePrefix,
                                                   boolean useDaemonThreads) {

        checkArgument(numThreads > 0, "numThreads: %s (expected: > 0)", numThreads);
        requireNonNull(threadNamePrefix, "threadNamePrefix");

        final TransportType type = TransportType.detectTransportType();
        final String prefix = threadNamePrefix + '-' + type.lowerCasedName();
        return newEventLoopGroup(numThreads, new EventLoopThreadFactory(prefix, useDaemonThreads));
    }