Examples of WorkerInfo


Examples of org.apache.giraph.worker.WorkerInfo

   * @param message The message sent to the target
   */
  public void sendMessageRequest(I destVertexId, M message) {
    PartitionOwner owner =
      getServiceWorker().getVertexPartitionOwner(destVertexId);
    WorkerInfo workerInfo = owner.getWorkerInfo();
    final int partitionId = owner.getPartitionId();
    if (LOG.isTraceEnabled()) {
      LOG.trace("sendMessageRequest: Send bytes (" + message.toString() +
        ") to " + destVertexId + " on worker " + workerInfo);
    }
View Full Code Here

Examples of org.apache.giraph.worker.WorkerInfo

  }

  @Override
  public void sendToOwner(String name, GlobalCommType sendType, Writable object)
    throws IOException {
    WorkerInfo owner =
        AggregatorUtils.getOwner(name, service.getWorkerInfoList());
    int currentSize = sendGlobalCommCache.addValue(owner.getTaskId(),
        name, sendType, object);
    if (currentSize >= maxBytesPerAggregatorRequest) {
      flushAggregatorsToWorker(owner);
    }
  }
View Full Code Here

Examples of org.apache.giraph.worker.WorkerInfo

    resetIdSerializers();
    resetIdCounter();
    // Count messages
    int currentMachineId = 0;
    PartitionOwner owner = null;
    WorkerInfo workerInfo = null;
    I vertexId = null;
    while (vertexIdIterator.hasNext()) {
      vertexId = vertexIdIterator.next();
      owner = getServiceWorker().getVertexPartitionOwner(vertexId);
      workerInfo = owner.getWorkerInfo();
      currentMachineId = workerInfo.getTaskId();
      // Serialize this target vertex id
      try {
        vertexId.write(idSerializer[currentMachineId]);
      } catch (IOException e) {
        throw new IllegalStateException(
View Full Code Here

Examples of org.apache.giraph.worker.WorkerInfo

  @Override
  public boolean sendEdgeRequest(I sourceVertexId, Edge<I, E> edge)
    throws IOException {
    PartitionOwner owner =
        serviceWorker.getVertexPartitionOwner(sourceVertexId);
    WorkerInfo workerInfo = owner.getWorkerInfo();
    final int partitionId = owner.getPartitionId();
    if (LOG.isTraceEnabled()) {
      LOG.trace("sendEdgeRequest: Send bytes (" + edge.toString() +
          ") to " + sourceVertexId + " on worker " + workerInfo);
    }
View Full Code Here

Examples of org.apache.giraph.worker.WorkerInfo

  }

  @Override
  public boolean sendReducedValue(String name,
      Writable reducedValue) throws IOException {
    WorkerInfo owner =
        AggregatorUtils.getOwner(name,
            serviceWorker.getWorkerInfoList());
    if (isThisWorker(owner)) {
      return false;
    } else {
      int currentSize = sendReducedValuesCache.addValue(owner.getTaskId(),
          name, GlobalCommType.REDUCED_VALUE, reducedValue);
      if (currentSize >= maxBytesPerAggregatorRequest) {
        flushAggregatorsToWorker(owner);
      }
      return true;
View Full Code Here

Examples of org.randomgd.bukkit.workers.info.WorkerInfo

    boolean cancelEvent = false;
    ItemStack stack = player.getItemInHand();
    Material material = stack.getType();
    Villager villager = (Villager) entity;
    UUID id = villager.getUniqueId();
    WorkerInfo info = workerStack.get(id);
    boolean reassign = true;
    if (info != null) {
      if (!player.hasPermission("usefulvillagers.give")) {
        player.sendMessage(NO_GIVE_PERMISSION_MESSAGE);
        return cancelEvent;
      }
      cancelEvent = give(info, player, stack, material);
      reassign = !cancelEvent;
    }

    if (reassign) {
      WorkerCreator creator = PROFESSION_TRIGGER.get(material);
      if (creator != null) {
        Villager.Profession profession = creator.getProfession();
        if ((profession != null)
            && (!(profession.equals(villager.getProfession()) && (info != null)))) {
          // It's ok, we can convert it !
          if (!player.hasPermission(creator.getPermission())) {
            player.sendMessage(NO_JOB_PERMISSION_MESSAGE);
            return cancelEvent;
          }
          villager.setProfession(profession);
          info = creator.create();
          info.setConfiguration(configurationHandler);
          workerStack.put(id, info);
          player.sendMessage(creator.getMessage());
          cancelEvent = true;
        }
      }
View Full Code Here

Examples of org.randomgd.bukkit.workers.info.WorkerInfo

   */
  private void interactWithGolem(Player player, Entity entity) {
    ItemStack stack = player.getItemInHand();
    Material material = stack.getType();
    UUID uuid = entity.getUniqueId();
    WorkerInfo currentInfo = workerStack.get(uuid);
    if (material.equals(Material.TORCH)) {
      if (currentInfo == null) {
        currentInfo = new GolemInfo();
        workerStack.put(uuid, currentInfo);
      }
      give(currentInfo, player, stack, material);
    } else if (material.equals(Material.STICK)) {
      if (currentInfo != null) {
        currentInfo.printInfoToPlayer(player);
      }
    }
  }
View Full Code Here

Examples of org.randomgd.bukkit.workers.info.WorkerInfo

          FileInputStream input = new FileInputStream(dataFile);
          JsonReader reader = new JsonReader(new InputStreamReader(
              input, "UTF-8"));
          reader.beginArray();
          while (reader.hasNext()) {
            WorkerInfo info = deserializer.fromJson(reader,
                WorkerInfo.class);
            workerStack.put(adapter.getCurrentUUID(), info);
          }
          reader.endArray();
          reader.close();
View Full Code Here

Examples of org.randomgd.bukkit.workers.info.WorkerInfo

  public boolean perform() {
    boolean result = true;
    if (entity.isDead()) {
      result = false;
    } else {
      WorkerInfo information = database.get(id);
      if (information != null) {
        Location currentLocation = entity.getLocation();
        int x = currentLocation.getBlockX();
        int y = currentLocation.getBlockY();
        int z = currentLocation.getBlockZ();
        World world = entity.getWorld();
        information.perform(entity, x, y, z, world);
      }
    }
    return result;
  }
View Full Code Here

Examples of org.randomgd.bukkit.workers.info.WorkerInfo

  /**
   * @return A worker information handler.
   */
  public WorkerInfo create() {
    WorkerInfo result = null;
    try {
      result = constructor.newInstance();
    } catch (Exception ex) {
      // ... Really ?? Too bad ...
      System.err.println("The code must be lame ...");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.