Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2023 Neil C Smith.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License version 3
* along with this work; if not, see http://www.gnu.org/licenses/
*
*
* Please visit https://www.praxislive.org if you need additional information or
* have any questions.
*/
package org.praxislive.hub;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.praxislive.core.Clock;
import org.praxislive.core.ComponentAddress;
import org.praxislive.core.Lookup;
import org.praxislive.core.Packet;
import org.praxislive.core.Root;
import org.praxislive.core.RootHub;
import org.praxislive.core.services.Service;
import org.praxislive.core.services.Services;
import org.praxislive.script.DefaultScriptService;
/**
* Support for configuring and running a {@link RootHub}, along with the
* {@link Root}s within it.
*
* This class doesn't implement either RootHub or Root directly. It uses a core
* root, usually an instance or subclass of {@link BasicCoreRoot}, to manage
* other system and user roots.
*
* Use {@link #builder()} to configure and create an instance of this class.
*/
public final class Hub {
public final static String SYS_PREFIX = "_sys_";
public final static String CORE_PREFIX = SYS_PREFIX + "core_";
public final static String EXT_PREFIX = SYS_PREFIX + "ext_";
private final ConcurrentMap roots;
private final ConcurrentMap, List> services;
private final Root core;
private final Lookup lookup;
private final RootHubImpl rootHub;
private final List rootIDs;
private Root.Controller coreController;
long startTime;
private Hub(Builder builder) {
CoreRootFactory coreFactory = builder.coreRootFactory;
List exts = new ArrayList<>();
extractExtensions(builder, exts);
core = coreFactory.createCoreRoot(new Accessor(), exts);
List