public Multimap<Node, Split> computeAssignments(Set<Split> splits) { Multimap<Node, Split> assignment = HashMultimap.create(); for (Split split : splits) { List<Node> candidateNodes; if (locationAwareScheduling) { candidateNodes = selectCandidateNodes(nodeMap.get().get(), split); } else { candidateNodes = selectRandomNodes(minCandidates); } checkCondition( !candidateNodes.isEmpty(), NO_NODES_AVAILABLE, "No nodes available to run query"); Node chosen = null; int min = Integer.MAX_VALUE; for (Node node : candidateNodes) { RemoteTask task = taskMap.get(node); int currentSplits = (task == null) ? 0 : task.getQueuedSplits(); int assignedSplits = currentSplits + assignment.get(node).size(); if (assignedSplits < min && assignedSplits < maxPendingSplitsPerTask) { chosen = node; min = assignedSplits; } } if (chosen != null) { assignment.put(chosen, split); } } return assignment; }
@SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_esperando); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); getIntent().setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); Intent intent = getIntent(); String message = intent.getStringExtra(Player.MODO_JUEGO); modo_juego = Integer.parseInt(message); if (modo_juego == Player.MODO_ESPIA) { tracker_id = intent.getStringExtra(Player.TRACKER_ID); } if (j == 0) { j++; RemoteTask task = new RemoteTask(); task.execute(new Integer[] {modo_juego}); } /* TimerTask task = new TimerTask() { @Override public void run() { Intent mainIntent = new Intent().setClass(EsperandoActivity.this, MapTestActivity.class); startActivity(mainIntent); finish();//Destruimos esta activity para prevenit que el usuario retorne aqui presionando el boton Atras. } }; Timer timer = new Timer(); timer.schedule(task, splashDelay);*/ }