This project has retired. For details please refer to its Attic page.
Source code
001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.reef.client;
020
021import org.apache.reef.annotations.Provided;
022import org.apache.reef.annotations.audience.ClientSide;
023import org.apache.reef.annotations.audience.Public;
024import org.apache.reef.io.Message;
025import org.apache.reef.io.naming.Identifiable;
026
027/**
028 * A message received by the client from the driver.
029 */
030@Public
031@ClientSide
032@Provided
033public final class JobMessage implements Message, Identifiable {
034
035  private final String id;
036  private final byte[] value;
037
038  /**
039   * @param id    the identifier of the sending Job
040   * @param value the message
041   */
042  public JobMessage(final String id, final byte[] value) {
043    this.id = id;
044    this.value = value;
045  }
046
047  /**
048   * Get the message sent by the Job.
049   *
050   * @return the message sent by the Job.
051   */
052  @Override
053  public byte[] get() {
054    return this.value;
055  }
056
057  /**
058   * Get the Identifier of the sending Job.
059   *
060   * @return the Identifier of the sending Job.
061   */
062  @Override
063  public String getId() {
064    return this.id;
065  }
066
067  @Override
068  public String toString() {
069    return "JobMessage{" +
070        "id='" + id + '\'' +
071        ", value.length=" + value.length +
072        '}';
073  }
074}