1/*
2 * Copyright (C) 2013 Google Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.google.caliper.bridge;
18
19import static com.google.common.base.Preconditions.checkNotNull;
20
21import java.io.Serializable;
22import java.util.UUID;
23
24/**
25 * A message sent from the worker to the runner immediately after startup to identify the trial
26 * that it is performing.
27 */
28public final class StartupAnnounceMessage implements Serializable {
29  private static final long serialVersionUID = 1L;
30
31  private final UUID trialId;
32
33  public StartupAnnounceMessage(UUID trialId) {
34    this.trialId = checkNotNull(trialId);
35  }
36
37  public UUID trialId() {
38    return trialId;
39  }
40
41  @Override public int hashCode() {
42    return trialId.hashCode();
43  }
44
45  @Override public boolean equals(Object obj) {
46    return obj instanceof StartupAnnounceMessage
47        && trialId.equals(((StartupAnnounceMessage) obj).trialId);
48  }
49}
50