preferredNodes.add(new InetSocketAddress("123.4.5.6", 20000));
preferredNodes.add(new InetSocketAddress("7.0.0.9", 45));
// Create a single task with three placement preferences.
ByteBuffer message = ByteBuffer.allocate(1);
TPlacementPreference placementPreference = new TPlacementPreference();
for (InetSocketAddress address : preferredNodes) {
placementPreference.addToNodes(address.getAddress().getHostAddress());
}
TTaskSpec task = new TTaskSpec("test task", placementPreference, message);
// Create the scheduling request.
List<TTaskSpec> tasks = new ArrayList<TTaskSpec>();