Tabnine Logo
Hosting
Code IndexAdd Tabnine to your IDE (free)

How to use
Hosting
in
cloud.orbit.actors.runtime

Best Java code snippets using cloud.orbit.actors.runtime.Hosting (Showing top 16 results out of 315)

origin: orbit/orbit

private Task<NodeAddress> locateActiveActor(final RemoteReference<?> actorReference)
{
  final NodeAddress address = localAddressCache.getIfPresent(actorReference);
  if (address != null && activeNodes.containsKey(address))
  {
    return Task.fromValue(address);
  }
  // try to locate the actor in the distributed directory
  // this can be expensive, less that activating the actor, though
  return Task.fromValue(getDistributedDirectory().get(createRemoteKey(actorReference)));
}
origin: orbit/orbit

@Override
public List<NodeAddress> getAllNodes()
{
  if (hosting == null)
  {
    return Collections.emptyList();
  }
  return hosting.getAllNodes();
}
origin: orbit/orbit

/**
 * Uses consistent hashing to determine this node is the "owner" of a certain key.
 *
 * @param key
 * @return true if this node is assigned to "own" the key.
 */
public boolean isConsistentHashOwner(final String key)
{
  final NodeAddress owner = getConsistentHashOwner(key);
  return clusterPeer.localAddress().equals(owner);
}
origin: orbit/orbit

  hosting = new Hosting(localAddressCacheMaximumSize, localAddressCacheTTL);
    });
hosting.setNodeType(mode == StageMode.HOST ? NodeCapabilities.NodeTypeEnum.SERVER : NodeCapabilities.NodeTypeEnum.CLIENT);
execution.setRuntime(this);
execution.setObjects(objects);
hosting.setStage(this);
hosting.setClusterPeer(clusterPeer);
    .findFirst()
    .orElse(new RandomSelectorExtension());
hosting.setNodeSelector(nodeSelector);
hosting.setTargetPlacementGroups(Collections.singleton(placementGroup));
messaging.start();
logger.debug("Starting hosting...");
hosting.start();
logger.debug("Starting execution...");
execution.start();
origin: orbit/orbit

private Task<NodeAddress> locateAndActivateActor(final RemoteReference<?> actorReference)
  final RemoteKey remoteKey = createRemoteKey(actorReference);
    if (shouldPlaceLocally(interfaceClass))
      return selectNode(interfaceClass.getName());
  final ConcurrentMap<RemoteKey, NodeAddress> distributedDirectory = getDistributedDirectory();
  if (shouldPlaceLocally(interfaceClass))
  Task<NodeAddress> nodeAddressTask = nodeAddress != null ? Task.fromValue(nodeAddress) : selectNode(interfaceClass.getName());
origin: orbit/orbit

  for (int i = 0; i < 10; i++)
    final String hash = getHash(addrHexStr + ":" + i);
    newHashes.put(hash, nodeInfo);
updateServerNodes();
origin: orbit/orbit

waitForServers();
  waitForServers();
  final NodeInfo nodeInfo = nodeSelector.select(interfaceClassName, getNodeAddress(), suitableNodes);
  return Task.fromValue(nodeInfo.address);
origin: orbit/orbit

private Task onInvocation(final HandlerContext ctx, final Invocation invocation)
  final NodeAddress localAddress = getNodeAddress();
  return locateActor(invocation.getToReference(), true)
      .whenComplete((r, e) -> {
        if (e != null)
origin: orbit/orbit

public List<NodeAddress> getServerNodes()
{
  if (hosting == null)
  {
    return Collections.emptyList();
  }
  return hosting.getServerNodes();
}
origin: orbit/orbit

@Override
public NodeAddress getLocalAddress()
{
  return hosting.getNodeAddress();
}
origin: orbit/orbit

/**
 * Uses consistent hashing to determine the "owner" of a certain key.
 *
 * @param key
 * @return the NodeAddress of the node that's supposed to own the key.
 */
public NodeAddress getConsistentHashOwner(final String key)
{
  final String keyHash = getHash(key);
  final TreeMap<String, NodeInfo> currentHashes = consistentHashNodeTree;
  Map.Entry<String, NodeInfo> info = currentHashes.ceilingEntry(keyHash);
  if (info == null)
  {
    info = currentHashes.firstEntry();
  }
  return info.getValue().address;
}
origin: orbit/orbit

hosting.actorDeactivated(actorEntry.getRemoteReference());
origin: orbit/orbit

stage.getHosting().canActivate(c.getName()).join();
origin: orbit/orbit

public boolean canActivateActor(final String interfaceName)
{
  if (getState() != NodeCapabilities.NodeState.RUNNING)
  {
    // todo, improve this
    if (hosting.getServerNodes().size() > 1)
    {
      return false;
    }
  }
  Class<Actor> aInterface = InternalUtils.classForName(interfaceName, true);
  if (aInterface == null)
  {
    return false;
  }
  final Class<?> concreteClass = finder.findActorImplementation(aInterface);
  return concreteClass != null;
}
origin: orbit/orbit

@Override
public <T extends ActorObserver> T registerObserver(Class<T> iClass, String id, final T observer)
{
  final RemoteReference<T> reference = objects.getOrAddLocalObjectReference(hosting.getNodeAddress(), iClass, id, observer);
  RemoteReference.setRuntime(reference, this);
  //noinspection unchecked
  return iClass != null ? iClass.cast(reference) : (T) reference;
}
origin: orbit/orbit

public void actorDeactivated(RemoteReference remoteReference)
{
  // removing the reference from the cluster directory and local caches
  getDistributedDirectory().remove(createRemoteKey(remoteReference), clusterPeer.localAddress());
  localAddressCache.invalidate(remoteReference);
  if(stage.getBroadcastActorDeactivations())
  {
    for (final NodeInfo info : activeNodes.values())
    {
      if (!info.address.equals(clusterPeer.localAddress()) && info.state == NodeState.RUNNING)
      {
        info.nodeCapabilities.remove(remoteReference);
      }
    }
  }
}
cloud.orbit.actors.runtimeHosting

Most used methods

  • <init>
  • actorDeactivated
  • canActivate
  • createRemoteKey
  • getAllNodes
  • getConsistentHashOwner
    Uses consistent hashing to determine the "owner" of a certain key.
  • getDistributedDirectory
  • getHash
  • getNodeAddress
  • getServerNodes
  • locateActiveActor
  • locateActor
  • locateActiveActor,
  • locateActor,
  • locateAndActivateActor,
  • notifyStateChange,
  • onClusterViewChanged,
  • onInvocation,
  • selectNode,
  • setClusterPeer,
  • setNodeSelector,
  • setNodeType

Popular in Java

  • Making http post requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (Timer)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now