You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by pt...@apache.org on 2015/05/15 20:02:47 UTC
[05/13] storm git commit: STORM-765: Thrift serialization for local
state.
STORM-765: Thrift serialization for local state.
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/b1dc422b
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/b1dc422b
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/b1dc422b
Branch: refs/heads/0.10.x-branch
Commit: b1dc422bd502ad031d027ba0c026c3e666abe42f
Parents: 24e3b98
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Mon Apr 13 13:51:09 2015 -0500
Committer: P. Taylor Goetz <pt...@gmail.com>
Committed: Fri May 15 12:58:02 2015 -0400
----------------------------------------------------------------------
.../src/clj/backtype/storm/daemon/common.clj | 13 -
.../clj/backtype/storm/daemon/supervisor.clj | 34 +-
.../src/clj/backtype/storm/daemon/worker.clj | 14 +-
.../src/clj/backtype/storm/local_state.clj | 99 +++
storm-core/src/clj/backtype/storm/testing.clj | 6 +-
.../storm/generated/LSApprovedWorkers.java | 458 +++++++++++
.../generated/LSSupervisorAssignments.java | 471 ++++++++++++
.../storm/generated/LSSupervisorId.java | 406 ++++++++++
.../storm/generated/LSWorkerHeartbeat.java | 755 +++++++++++++++++++
.../storm/generated/LocalAssignment.java | 561 ++++++++++++++
.../storm/generated/LocalStateData.java | 471 ++++++++++++
.../storm/generated/ThriftSerializedObject.java | 516 +++++++++++++
.../jvm/backtype/storm/utils/LocalState.java | 163 +++-
storm-core/src/py/storm/ttypes.py | 594 +++++++++++++++
storm-core/src/storm.thrift | 33 +
.../clj/backtype/storm/local_state_test.clj | 40 +-
16 files changed, 4530 insertions(+), 104 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/b1dc422b/storm-core/src/clj/backtype/storm/daemon/common.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/daemon/common.clj b/storm-core/src/clj/backtype/storm/daemon/common.clj
index c33609d..65482f3 100644
--- a/storm-core/src/clj/backtype/storm/daemon/common.clj
+++ b/storm-core/src/clj/backtype/storm/daemon/common.clj
@@ -58,19 +58,6 @@
(defprotocol DaemonCommon
(waiting? [this]))
-(def LS-WORKER-HEARTBEAT "worker-heartbeat")
-
-;; LocalState constants
-(def LS-ID "supervisor-id")
-(def LS-LOCAL-ASSIGNMENTS "local-assignments")
-(def LS-APPROVED-WORKERS "approved-workers")
-
-(defn mk-local-worker-heartbeat [time-secs storm-id executors port]
- {:time-secs time-secs
- :storm-id storm-id
- :executors executors
- :port port})
-
(defrecord ExecutorStats [^long processed
^long acked
^long emitted
http://git-wip-us.apache.org/repos/asf/storm/blob/b1dc422b/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/daemon/supervisor.clj b/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
index bc8b999..7801690 100644
--- a/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
+++ b/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
@@ -24,7 +24,7 @@
[java.net URI]
[org.apache.commons.io FileUtils]
[java.io File])
- (:use [backtype.storm config util log timer])
+ (:use [backtype.storm config util log timer local-state])
(:use [backtype.storm.daemon common])
(:require [backtype.storm.daemon [worker :as worker]]
[backtype.storm [process-simulator :as psim] [cluster :as cluster] [event :as event]]
@@ -38,9 +38,6 @@
(defmulti download-storm-code cluster-mode)
(defmulti launch-worker (fn [supervisor & _] (cluster-mode (:conf supervisor))))
-;; used as part of a map from port to this
-(defrecord LocalAssignment [storm-id executors])
-
(defprotocol SupervisorDaemon
(get-id [this])
(get-conf [this])
@@ -76,7 +73,7 @@
(into {} (for [[port executors] port-executors]
;; need to cast to int b/c it might be a long (due to how yaml parses things)
;; doall is to avoid serialization/deserialization problems with lazy seqs
- [(Integer. port) (LocalAssignment. storm-id (doall executors))]
+ [(Integer. port) (mk-local-assignment storm-id (doall executors))]
))))
(defn- read-assignments
@@ -104,8 +101,8 @@
(defn read-worker-heartbeat [conf id]
(let [local-state (worker-state conf id)]
(try
- (.get local-state LS-WORKER-HEARTBEAT)
- (catch IOException e
+ (ls-worker-heartbeat local-state)
+ (catch Exception e
(log-warn e "Failed to read local heartbeat for workerId : " id ",Ignoring exception.")
nil))))
@@ -148,7 +145,7 @@
(let [conf (:conf supervisor)
^LocalState local-state (:local-state supervisor)
id->heartbeat (read-worker-heartbeats conf)
- approved-ids (set (keys (.get local-state LS-APPROVED-WORKERS)))]
+ approved-ids (set (keys (ls-approved-workers local-state)))]
(into
{}
(dofor [[id hb] id->heartbeat]
@@ -174,7 +171,7 @@
(defn- wait-for-worker-launch [conf id start-time]
(let [state (worker-state conf id)]
(loop []
- (let [hb (.get state LS-WORKER-HEARTBEAT)]
+ (let [hb (ls-worker-heartbeat state)]
(when (and
(not hb)
(<
@@ -185,7 +182,7 @@
(Time/sleep 500)
(recur)
)))
- (when-not (.get state LS-WORKER-HEARTBEAT)
+ (when-not (ls-worker-heartbeat state)
(log-message "Worker " id " failed to start")
)))
@@ -320,7 +317,7 @@
download-lock (:download-lock supervisor)
^LocalState local-state (:local-state supervisor)
storm-cluster-state (:storm-cluster-state supervisor)
- assigned-executors (defaulted (.get local-state LS-LOCAL-ASSIGNMENTS) {})
+ assigned-executors (defaulted (ls-local-assignments local-state) {})
now (current-time-secs)
allocated (read-allocated-workers supervisor assigned-executors now)
keepers (filter-val
@@ -358,9 +355,9 @@
(doseq [id (vals new-worker-ids)]
(local-mkdirs (worker-pids-root conf id))
(local-mkdirs (worker-heartbeats-root conf id)))
- (.put local-state LS-APPROVED-WORKERS
+ (ls-approved-workers! local-state
(merge
- (select-keys (.get local-state LS-APPROVED-WORKERS)
+ (select-keys (ls-approved-workers local-state)
(keys keepers))
(zipmap (vals new-worker-ids) (keys new-worker-ids))
))
@@ -416,7 +413,7 @@
(defn shutdown-disallowed-workers [supervisor]
(let [conf (:conf supervisor)
^LocalState local-state (:local-state supervisor)
- assigned-executors (defaulted (.get local-state LS-LOCAL-ASSIGNMENTS) {})
+ assigned-executors (defaulted (ls-local-assignments local-state) {})
now (current-time-secs)
allocated (read-allocated-workers supervisor assigned-executors now)
disallowed (keys (filter-val
@@ -442,7 +439,7 @@
assignment-versions)
storm-code-map (read-storm-code-locations assignments-snapshot)
downloaded-storm-ids (set (read-downloaded-storm-ids conf))
- existing-assignment (.get local-state LS-LOCAL-ASSIGNMENTS)
+ existing-assignment (ls-local-assignments local-state)
all-assignment (read-assignments assignments-snapshot
(:assignment-id supervisor)
existing-assignment
@@ -472,8 +469,7 @@
(set (keys new-assignment)))]
(.killedWorker isupervisor (int p)))
(.assigned isupervisor (keys new-assignment))
- (.put local-state
- LS-LOCAL-ASSIGNMENTS
+ (ls-local-assignments! local-state
new-assignment)
(reset! (:assignment-versions supervisor) versions)
(reset! (:curr-assignment supervisor) new-assignment)
@@ -780,10 +776,10 @@
(prepare [this conf local-dir]
(reset! conf-atom conf)
(let [state (LocalState. local-dir)
- curr-id (if-let [id (.get state LS-ID)]
+ curr-id (if-let [id (ls-supervisor-id state)]
id
(generate-supervisor-id))]
- (.put state LS-ID curr-id)
+ (ls-supervisor-id! state curr-id)
(reset! id-atom curr-id))
)
(confirmAssigned [this port]
http://git-wip-us.apache.org/repos/asf/storm/blob/b1dc422b/storm-core/src/clj/backtype/storm/daemon/worker.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/daemon/worker.clj b/storm-core/src/clj/backtype/storm/daemon/worker.clj
index e0263d6..978ea16 100644
--- a/storm-core/src/clj/backtype/storm/daemon/worker.clj
+++ b/storm-core/src/clj/backtype/storm/daemon/worker.clj
@@ -15,7 +15,7 @@
;; limitations under the License.
(ns backtype.storm.daemon.worker
(:use [backtype.storm.daemon common])
- (:use [backtype.storm config log util timer])
+ (:use [backtype.storm config log util timer local-state])
(:require [backtype.storm.daemon [executor :as executor]])
(:require [backtype.storm [disruptor :as disruptor] [cluster :as cluster]])
(:require [clojure.set :as set])
@@ -68,19 +68,9 @@
(defn do-heartbeat [worker]
(let [conf (:conf worker)
- hb (mk-local-worker-heartbeat
- (current-time-secs)
- (:storm-id worker)
- (:executors worker)
- (:port worker))
state (worker-state conf (:worker-id worker))]
- (log-debug "Doing heartbeat " (pr-str hb))
;; do the local-file-system heartbeat.
- (.put state
- LS-WORKER-HEARTBEAT
- hb
- false
- )
+ (ls-worker-heartbeat! state (current-time-secs) (:storm-id worker) (:executors worker) (:port worker))
(.cleanup state 60) ; this is just in case supervisor is down so that disk doesn't fill up.
; it shouldn't take supervisor 120 seconds between listing dir and reading it
http://git-wip-us.apache.org/repos/asf/storm/blob/b1dc422b/storm-core/src/clj/backtype/storm/local_state.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/local_state.clj b/storm-core/src/clj/backtype/storm/local_state.clj
new file mode 100644
index 0000000..41e3675
--- /dev/null
+++ b/storm-core/src/clj/backtype/storm/local_state.clj
@@ -0,0 +1,99 @@
+;; Licensed to the Apache Software Foundation (ASF) under one
+;; or more contributor license agreements. See the NOTICE file
+;; distributed with this work for additional information
+;; regarding copyright ownership. The ASF licenses this file
+;; to you under the Apache License, Version 2.0 (the
+;; "License"); you may not use this file except in compliance
+;; with the License. You may obtain a copy of the License at
+;;
+;; http://www.apache.org/licenses/LICENSE-2.0
+;;
+;; Unless required by applicable law or agreed to in writing, software
+;; distributed under the License is distributed on an "AS IS" BASIS,
+;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+;; See the License for the specific language governing permissions and
+;; limitations under the License.
+(ns backtype.storm.local-state
+ (:use [backtype.storm log util])
+ (:import [backtype.storm.generated StormTopology
+ InvalidTopologyException GlobalStreamId
+ LSSupervisorId LSApprovedWorkers
+ LSSupervisorAssignments LocalAssignment
+ ExecutorInfo LSWorkerHeartbeat])
+ (:import [backtype.storm.utils LocalState]))
+
+(def LS-WORKER-HEARTBEAT "worker-heartbeat")
+(def LS-ID "supervisor-id")
+(def LS-LOCAL-ASSIGNMENTS "local-assignments")
+(def LS-APPROVED-WORKERS "approved-workers")
+
+(defn ls-supervisor-id!
+ [^LocalState local-state ^String id]
+ (.put local-state LS-ID (LSSupervisorId. id)))
+
+(defn ls-supervisor-id
+ [^LocalState local-state]
+ (if-let [super-id (.get local-state LS-ID)]
+ (.get_supervisor_id super-id)))
+
+(defn ls-approved-workers!
+ [^LocalState local-state workers]
+ (.put local-state LS-APPROVED-WORKERS (LSApprovedWorkers. workers)))
+
+(defn ls-approved-workers
+ [^LocalState local-state]
+ (if-let [tmp (.get local-state LS-APPROVED-WORKERS)]
+ (into {} (.get_approved_workers tmp))))
+
+(defn ->ExecutorInfo
+ [[low high]] (ExecutorInfo. low high))
+
+(defn ->ExecutorInfo-list
+ [executors]
+ (map ->ExecutorInfo executors))
+
+(defn ->executor-list
+ [executors]
+ (into []
+ (for [exec-info executors]
+ [(.get_task_start exec-info) (.get_task_end exec-info)])))
+
+(defn ->LocalAssignment
+ [{storm-id :storm-id executors :executors}]
+ (LocalAssignment. storm-id (->ExecutorInfo-list executors)))
+
+(defn mk-local-assignment
+ [storm-id executors]
+ {:storm-id storm-id :executors executors})
+
+(defn ->local-assignment
+ [^LocalAssignment thrift-local-assignment]
+ (mk-local-assignment
+ (.get_topology_id thrift-local-assignment)
+ (->executor-list (.get_executors thrift-local-assignment))))
+
+(defn ls-local-assignments!
+ [^LocalState local-state assignments]
+ (let [local-assignment-map (map-val ->LocalAssignment assignments)]
+ (.put local-state LS-LOCAL-ASSIGNMENTS
+ (LSSupervisorAssignments. local-assignment-map))))
+
+(defn ls-local-assignments
+ [^LocalState local-state]
+ (if-let [thrift-local-assignments (.get local-state LS-LOCAL-ASSIGNMENTS)]
+ (map-val
+ ->local-assignment
+ (.get_assignments thrift-local-assignments))))
+
+(defn ls-worker-heartbeat!
+ [^LocalState local-state time-secs storm-id executors port]
+ (.put local-state LS-WORKER-HEARTBEAT (LSWorkerHeartbeat. time-secs storm-id (->ExecutorInfo-list executors) port) false))
+
+(defn ls-worker-heartbeat
+ [^LocalState local-state]
+ (if-let [worker-hb (.get local-state LS-WORKER-HEARTBEAT)]
+ {:time-secs (.get_time_secs worker-hb)
+ :storm-id (.get_topology_id worker-hb)
+ :executors (->executor-list (.get_executors worker-hb))
+ :port (.get_port worker-hb)}))
+
http://git-wip-us.apache.org/repos/asf/storm/blob/b1dc422b/storm-core/src/clj/backtype/storm/testing.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/testing.clj b/storm-core/src/clj/backtype/storm/testing.clj
index 02bf13d..eccb46a 100644
--- a/storm-core/src/clj/backtype/storm/testing.clj
+++ b/storm-core/src/clj/backtype/storm/testing.clj
@@ -42,7 +42,7 @@
(:require [backtype.storm [zookeeper :as zk]])
(:require [backtype.storm.messaging.loader :as msg-loader])
(:require [backtype.storm.daemon.acker :as acker])
- (:use [backtype.storm cluster util thrift config log]))
+ (:use [backtype.storm cluster util thrift config log local-state]))
(defn feeder-spout
[fields]
@@ -302,13 +302,13 @@
(defn find-worker-id
[supervisor-conf port]
(let [supervisor-state (supervisor-state supervisor-conf)
- worker->port (.get supervisor-state common/LS-APPROVED-WORKERS)]
+ worker->port (ls-approved-workers supervisor-state)]
(first ((reverse-map worker->port) port))))
(defn find-worker-port
[supervisor-conf worker-id]
(let [supervisor-state (supervisor-state supervisor-conf)
- worker->port (.get supervisor-state common/LS-APPROVED-WORKERS)]
+ worker->port (ls-approved-workers supervisor-state)]
(worker->port worker-id)))
(defn mk-capture-shutdown-fn
http://git-wip-us.apache.org/repos/asf/storm/blob/b1dc422b/storm-core/src/jvm/backtype/storm/generated/LSApprovedWorkers.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/generated/LSApprovedWorkers.java b/storm-core/src/jvm/backtype/storm/generated/LSApprovedWorkers.java
new file mode 100644
index 0000000..1d97dca
--- /dev/null
+++ b/storm-core/src/jvm/backtype/storm/generated/LSApprovedWorkers.java
@@ -0,0 +1,458 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Autogenerated by Thrift Compiler (0.9.2)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package backtype.storm.generated;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import javax.annotation.Generated;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-4-10")
+public class LSApprovedWorkers implements org.apache.thrift.TBase<LSApprovedWorkers, LSApprovedWorkers._Fields>, java.io.Serializable, Cloneable, Comparable<LSApprovedWorkers> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("LSApprovedWorkers");
+
+ private static final org.apache.thrift.protocol.TField APPROVED_WORKERS_FIELD_DESC = new org.apache.thrift.protocol.TField("approved_workers", org.apache.thrift.protocol.TType.MAP, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new LSApprovedWorkersStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new LSApprovedWorkersTupleSchemeFactory());
+ }
+
+ private Map<String,Integer> approved_workers; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ APPROVED_WORKERS((short)1, "approved_workers");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // APPROVED_WORKERS
+ return APPROVED_WORKERS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.APPROVED_WORKERS, new org.apache.thrift.meta_data.FieldMetaData("approved_workers", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(LSApprovedWorkers.class, metaDataMap);
+ }
+
+ public LSApprovedWorkers() {
+ }
+
+ public LSApprovedWorkers(
+ Map<String,Integer> approved_workers)
+ {
+ this();
+ this.approved_workers = approved_workers;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public LSApprovedWorkers(LSApprovedWorkers other) {
+ if (other.is_set_approved_workers()) {
+ Map<String,Integer> __this__approved_workers = new HashMap<String,Integer>(other.approved_workers);
+ this.approved_workers = __this__approved_workers;
+ }
+ }
+
+ public LSApprovedWorkers deepCopy() {
+ return new LSApprovedWorkers(this);
+ }
+
+ @Override
+ public void clear() {
+ this.approved_workers = null;
+ }
+
+ public int get_approved_workers_size() {
+ return (this.approved_workers == null) ? 0 : this.approved_workers.size();
+ }
+
+ public void put_to_approved_workers(String key, int val) {
+ if (this.approved_workers == null) {
+ this.approved_workers = new HashMap<String,Integer>();
+ }
+ this.approved_workers.put(key, val);
+ }
+
+ public Map<String,Integer> get_approved_workers() {
+ return this.approved_workers;
+ }
+
+ public void set_approved_workers(Map<String,Integer> approved_workers) {
+ this.approved_workers = approved_workers;
+ }
+
+ public void unset_approved_workers() {
+ this.approved_workers = null;
+ }
+
+ /** Returns true if field approved_workers is set (has been assigned a value) and false otherwise */
+ public boolean is_set_approved_workers() {
+ return this.approved_workers != null;
+ }
+
+ public void set_approved_workers_isSet(boolean value) {
+ if (!value) {
+ this.approved_workers = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case APPROVED_WORKERS:
+ if (value == null) {
+ unset_approved_workers();
+ } else {
+ set_approved_workers((Map<String,Integer>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case APPROVED_WORKERS:
+ return get_approved_workers();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case APPROVED_WORKERS:
+ return is_set_approved_workers();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof LSApprovedWorkers)
+ return this.equals((LSApprovedWorkers)that);
+ return false;
+ }
+
+ public boolean equals(LSApprovedWorkers that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_approved_workers = true && this.is_set_approved_workers();
+ boolean that_present_approved_workers = true && that.is_set_approved_workers();
+ if (this_present_approved_workers || that_present_approved_workers) {
+ if (!(this_present_approved_workers && that_present_approved_workers))
+ return false;
+ if (!this.approved_workers.equals(that.approved_workers))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ List<Object> list = new ArrayList<Object>();
+
+ boolean present_approved_workers = true && (is_set_approved_workers());
+ list.add(present_approved_workers);
+ if (present_approved_workers)
+ list.add(approved_workers);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(LSApprovedWorkers other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(is_set_approved_workers()).compareTo(other.is_set_approved_workers());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (is_set_approved_workers()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.approved_workers, other.approved_workers);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("LSApprovedWorkers(");
+ boolean first = true;
+
+ sb.append("approved_workers:");
+ if (this.approved_workers == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.approved_workers);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!is_set_approved_workers()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'approved_workers' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class LSApprovedWorkersStandardSchemeFactory implements SchemeFactory {
+ public LSApprovedWorkersStandardScheme getScheme() {
+ return new LSApprovedWorkersStandardScheme();
+ }
+ }
+
+ private static class LSApprovedWorkersStandardScheme extends StandardScheme<LSApprovedWorkers> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, LSApprovedWorkers struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // APPROVED_WORKERS
+ if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map454 = iprot.readMapBegin();
+ struct.approved_workers = new HashMap<String,Integer>(2*_map454.size);
+ String _key455;
+ int _val456;
+ for (int _i457 = 0; _i457 < _map454.size; ++_i457)
+ {
+ _key455 = iprot.readString();
+ _val456 = iprot.readI32();
+ struct.approved_workers.put(_key455, _val456);
+ }
+ iprot.readMapEnd();
+ }
+ struct.set_approved_workers_isSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, LSApprovedWorkers struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.approved_workers != null) {
+ oprot.writeFieldBegin(APPROVED_WORKERS_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I32, struct.approved_workers.size()));
+ for (Map.Entry<String, Integer> _iter458 : struct.approved_workers.entrySet())
+ {
+ oprot.writeString(_iter458.getKey());
+ oprot.writeI32(_iter458.getValue());
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class LSApprovedWorkersTupleSchemeFactory implements SchemeFactory {
+ public LSApprovedWorkersTupleScheme getScheme() {
+ return new LSApprovedWorkersTupleScheme();
+ }
+ }
+
+ private static class LSApprovedWorkersTupleScheme extends TupleScheme<LSApprovedWorkers> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, LSApprovedWorkers struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ {
+ oprot.writeI32(struct.approved_workers.size());
+ for (Map.Entry<String, Integer> _iter459 : struct.approved_workers.entrySet())
+ {
+ oprot.writeString(_iter459.getKey());
+ oprot.writeI32(_iter459.getValue());
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, LSApprovedWorkers struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ {
+ org.apache.thrift.protocol.TMap _map460 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I32, iprot.readI32());
+ struct.approved_workers = new HashMap<String,Integer>(2*_map460.size);
+ String _key461;
+ int _val462;
+ for (int _i463 = 0; _i463 < _map460.size; ++_i463)
+ {
+ _key461 = iprot.readString();
+ _val462 = iprot.readI32();
+ struct.approved_workers.put(_key461, _val462);
+ }
+ }
+ struct.set_approved_workers_isSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/storm/blob/b1dc422b/storm-core/src/jvm/backtype/storm/generated/LSSupervisorAssignments.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/generated/LSSupervisorAssignments.java b/storm-core/src/jvm/backtype/storm/generated/LSSupervisorAssignments.java
new file mode 100644
index 0000000..4667287
--- /dev/null
+++ b/storm-core/src/jvm/backtype/storm/generated/LSSupervisorAssignments.java
@@ -0,0 +1,471 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Autogenerated by Thrift Compiler (0.9.2)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package backtype.storm.generated;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import javax.annotation.Generated;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-4-10")
+public class LSSupervisorAssignments implements org.apache.thrift.TBase<LSSupervisorAssignments, LSSupervisorAssignments._Fields>, java.io.Serializable, Cloneable, Comparable<LSSupervisorAssignments> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("LSSupervisorAssignments");
+
+ private static final org.apache.thrift.protocol.TField ASSIGNMENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("assignments", org.apache.thrift.protocol.TType.MAP, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new LSSupervisorAssignmentsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new LSSupervisorAssignmentsTupleSchemeFactory());
+ }
+
+ private Map<Integer,LocalAssignment> assignments; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ ASSIGNMENTS((short)1, "assignments");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // ASSIGNMENTS
+ return ASSIGNMENTS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.ASSIGNMENTS, new org.apache.thrift.meta_data.FieldMetaData("assignments", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32),
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, LocalAssignment.class))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(LSSupervisorAssignments.class, metaDataMap);
+ }
+
+ public LSSupervisorAssignments() {
+ }
+
+ public LSSupervisorAssignments(
+ Map<Integer,LocalAssignment> assignments)
+ {
+ this();
+ this.assignments = assignments;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public LSSupervisorAssignments(LSSupervisorAssignments other) {
+ if (other.is_set_assignments()) {
+ Map<Integer,LocalAssignment> __this__assignments = new HashMap<Integer,LocalAssignment>(other.assignments.size());
+ for (Map.Entry<Integer, LocalAssignment> other_element : other.assignments.entrySet()) {
+
+ Integer other_element_key = other_element.getKey();
+ LocalAssignment other_element_value = other_element.getValue();
+
+ Integer __this__assignments_copy_key = other_element_key;
+
+ LocalAssignment __this__assignments_copy_value = new LocalAssignment(other_element_value);
+
+ __this__assignments.put(__this__assignments_copy_key, __this__assignments_copy_value);
+ }
+ this.assignments = __this__assignments;
+ }
+ }
+
+ public LSSupervisorAssignments deepCopy() {
+ return new LSSupervisorAssignments(this);
+ }
+
+ @Override
+ public void clear() {
+ this.assignments = null;
+ }
+
+ public int get_assignments_size() {
+ return (this.assignments == null) ? 0 : this.assignments.size();
+ }
+
+ public void put_to_assignments(int key, LocalAssignment val) {
+ if (this.assignments == null) {
+ this.assignments = new HashMap<Integer,LocalAssignment>();
+ }
+ this.assignments.put(key, val);
+ }
+
+ public Map<Integer,LocalAssignment> get_assignments() {
+ return this.assignments;
+ }
+
+ public void set_assignments(Map<Integer,LocalAssignment> assignments) {
+ this.assignments = assignments;
+ }
+
+ public void unset_assignments() {
+ this.assignments = null;
+ }
+
+ /** Returns true if field assignments is set (has been assigned a value) and false otherwise */
+ public boolean is_set_assignments() {
+ return this.assignments != null;
+ }
+
+ public void set_assignments_isSet(boolean value) {
+ if (!value) {
+ this.assignments = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case ASSIGNMENTS:
+ if (value == null) {
+ unset_assignments();
+ } else {
+ set_assignments((Map<Integer,LocalAssignment>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case ASSIGNMENTS:
+ return get_assignments();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case ASSIGNMENTS:
+ return is_set_assignments();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof LSSupervisorAssignments)
+ return this.equals((LSSupervisorAssignments)that);
+ return false;
+ }
+
+ public boolean equals(LSSupervisorAssignments that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_assignments = true && this.is_set_assignments();
+ boolean that_present_assignments = true && that.is_set_assignments();
+ if (this_present_assignments || that_present_assignments) {
+ if (!(this_present_assignments && that_present_assignments))
+ return false;
+ if (!this.assignments.equals(that.assignments))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ List<Object> list = new ArrayList<Object>();
+
+ boolean present_assignments = true && (is_set_assignments());
+ list.add(present_assignments);
+ if (present_assignments)
+ list.add(assignments);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(LSSupervisorAssignments other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(is_set_assignments()).compareTo(other.is_set_assignments());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (is_set_assignments()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.assignments, other.assignments);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("LSSupervisorAssignments(");
+ boolean first = true;
+
+ sb.append("assignments:");
+ if (this.assignments == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.assignments);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!is_set_assignments()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'assignments' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class LSSupervisorAssignmentsStandardSchemeFactory implements SchemeFactory {
+ public LSSupervisorAssignmentsStandardScheme getScheme() {
+ return new LSSupervisorAssignmentsStandardScheme();
+ }
+ }
+
+ private static class LSSupervisorAssignmentsStandardScheme extends StandardScheme<LSSupervisorAssignments> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, LSSupervisorAssignments struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // ASSIGNMENTS
+ if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map464 = iprot.readMapBegin();
+ struct.assignments = new HashMap<Integer,LocalAssignment>(2*_map464.size);
+ int _key465;
+ LocalAssignment _val466;
+ for (int _i467 = 0; _i467 < _map464.size; ++_i467)
+ {
+ _key465 = iprot.readI32();
+ _val466 = new LocalAssignment();
+ _val466.read(iprot);
+ struct.assignments.put(_key465, _val466);
+ }
+ iprot.readMapEnd();
+ }
+ struct.set_assignments_isSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, LSSupervisorAssignments struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.assignments != null) {
+ oprot.writeFieldBegin(ASSIGNMENTS_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.STRUCT, struct.assignments.size()));
+ for (Map.Entry<Integer, LocalAssignment> _iter468 : struct.assignments.entrySet())
+ {
+ oprot.writeI32(_iter468.getKey());
+ _iter468.getValue().write(oprot);
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class LSSupervisorAssignmentsTupleSchemeFactory implements SchemeFactory {
+ public LSSupervisorAssignmentsTupleScheme getScheme() {
+ return new LSSupervisorAssignmentsTupleScheme();
+ }
+ }
+
+ private static class LSSupervisorAssignmentsTupleScheme extends TupleScheme<LSSupervisorAssignments> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, LSSupervisorAssignments struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ {
+ oprot.writeI32(struct.assignments.size());
+ for (Map.Entry<Integer, LocalAssignment> _iter469 : struct.assignments.entrySet())
+ {
+ oprot.writeI32(_iter469.getKey());
+ _iter469.getValue().write(oprot);
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, LSSupervisorAssignments struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ {
+ org.apache.thrift.protocol.TMap _map470 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.assignments = new HashMap<Integer,LocalAssignment>(2*_map470.size);
+ int _key471;
+ LocalAssignment _val472;
+ for (int _i473 = 0; _i473 < _map470.size; ++_i473)
+ {
+ _key471 = iprot.readI32();
+ _val472 = new LocalAssignment();
+ _val472.read(iprot);
+ struct.assignments.put(_key471, _val472);
+ }
+ }
+ struct.set_assignments_isSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/storm/blob/b1dc422b/storm-core/src/jvm/backtype/storm/generated/LSSupervisorId.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/generated/LSSupervisorId.java b/storm-core/src/jvm/backtype/storm/generated/LSSupervisorId.java
new file mode 100644
index 0000000..6ee4dad
--- /dev/null
+++ b/storm-core/src/jvm/backtype/storm/generated/LSSupervisorId.java
@@ -0,0 +1,406 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Autogenerated by Thrift Compiler (0.9.2)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package backtype.storm.generated;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import javax.annotation.Generated;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-4-10")
+public class LSSupervisorId implements org.apache.thrift.TBase<LSSupervisorId, LSSupervisorId._Fields>, java.io.Serializable, Cloneable, Comparable<LSSupervisorId> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("LSSupervisorId");
+
+ private static final org.apache.thrift.protocol.TField SUPERVISOR_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("supervisor_id", org.apache.thrift.protocol.TType.STRING, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new LSSupervisorIdStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new LSSupervisorIdTupleSchemeFactory());
+ }
+
+ private String supervisor_id; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ SUPERVISOR_ID((short)1, "supervisor_id");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // SUPERVISOR_ID
+ return SUPERVISOR_ID;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.SUPERVISOR_ID, new org.apache.thrift.meta_data.FieldMetaData("supervisor_id", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(LSSupervisorId.class, metaDataMap);
+ }
+
+ public LSSupervisorId() {
+ }
+
+ public LSSupervisorId(
+ String supervisor_id)
+ {
+ this();
+ this.supervisor_id = supervisor_id;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public LSSupervisorId(LSSupervisorId other) {
+ if (other.is_set_supervisor_id()) {
+ this.supervisor_id = other.supervisor_id;
+ }
+ }
+
+ public LSSupervisorId deepCopy() {
+ return new LSSupervisorId(this);
+ }
+
+ @Override
+ public void clear() {
+ this.supervisor_id = null;
+ }
+
+ public String get_supervisor_id() {
+ return this.supervisor_id;
+ }
+
+ public void set_supervisor_id(String supervisor_id) {
+ this.supervisor_id = supervisor_id;
+ }
+
+ public void unset_supervisor_id() {
+ this.supervisor_id = null;
+ }
+
+ /** Returns true if field supervisor_id is set (has been assigned a value) and false otherwise */
+ public boolean is_set_supervisor_id() {
+ return this.supervisor_id != null;
+ }
+
+ public void set_supervisor_id_isSet(boolean value) {
+ if (!value) {
+ this.supervisor_id = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case SUPERVISOR_ID:
+ if (value == null) {
+ unset_supervisor_id();
+ } else {
+ set_supervisor_id((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUPERVISOR_ID:
+ return get_supervisor_id();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case SUPERVISOR_ID:
+ return is_set_supervisor_id();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof LSSupervisorId)
+ return this.equals((LSSupervisorId)that);
+ return false;
+ }
+
+ public boolean equals(LSSupervisorId that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_supervisor_id = true && this.is_set_supervisor_id();
+ boolean that_present_supervisor_id = true && that.is_set_supervisor_id();
+ if (this_present_supervisor_id || that_present_supervisor_id) {
+ if (!(this_present_supervisor_id && that_present_supervisor_id))
+ return false;
+ if (!this.supervisor_id.equals(that.supervisor_id))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ List<Object> list = new ArrayList<Object>();
+
+ boolean present_supervisor_id = true && (is_set_supervisor_id());
+ list.add(present_supervisor_id);
+ if (present_supervisor_id)
+ list.add(supervisor_id);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(LSSupervisorId other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(is_set_supervisor_id()).compareTo(other.is_set_supervisor_id());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (is_set_supervisor_id()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.supervisor_id, other.supervisor_id);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("LSSupervisorId(");
+ boolean first = true;
+
+ sb.append("supervisor_id:");
+ if (this.supervisor_id == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.supervisor_id);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!is_set_supervisor_id()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'supervisor_id' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class LSSupervisorIdStandardSchemeFactory implements SchemeFactory {
+ public LSSupervisorIdStandardScheme getScheme() {
+ return new LSSupervisorIdStandardScheme();
+ }
+ }
+
+ private static class LSSupervisorIdStandardScheme extends StandardScheme<LSSupervisorId> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, LSSupervisorId struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // SUPERVISOR_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.supervisor_id = iprot.readString();
+ struct.set_supervisor_id_isSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, LSSupervisorId struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.supervisor_id != null) {
+ oprot.writeFieldBegin(SUPERVISOR_ID_FIELD_DESC);
+ oprot.writeString(struct.supervisor_id);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class LSSupervisorIdTupleSchemeFactory implements SchemeFactory {
+ public LSSupervisorIdTupleScheme getScheme() {
+ return new LSSupervisorIdTupleScheme();
+ }
+ }
+
+ private static class LSSupervisorIdTupleScheme extends TupleScheme<LSSupervisorId> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, LSSupervisorId struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeString(struct.supervisor_id);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, LSSupervisorId struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.supervisor_id = iprot.readString();
+ struct.set_supervisor_id_isSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/storm/blob/b1dc422b/storm-core/src/jvm/backtype/storm/generated/LSWorkerHeartbeat.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/generated/LSWorkerHeartbeat.java b/storm-core/src/jvm/backtype/storm/generated/LSWorkerHeartbeat.java
new file mode 100644
index 0000000..80f917b
--- /dev/null
+++ b/storm-core/src/jvm/backtype/storm/generated/LSWorkerHeartbeat.java
@@ -0,0 +1,755 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Autogenerated by Thrift Compiler (0.9.2)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package backtype.storm.generated;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import javax.annotation.Generated;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-4-10")
+public class LSWorkerHeartbeat implements org.apache.thrift.TBase<LSWorkerHeartbeat, LSWorkerHeartbeat._Fields>, java.io.Serializable, Cloneable, Comparable<LSWorkerHeartbeat> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("LSWorkerHeartbeat");
+
+ private static final org.apache.thrift.protocol.TField TIME_SECS_FIELD_DESC = new org.apache.thrift.protocol.TField("time_secs", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final org.apache.thrift.protocol.TField TOPOLOGY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("topology_id", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField EXECUTORS_FIELD_DESC = new org.apache.thrift.protocol.TField("executors", org.apache.thrift.protocol.TType.LIST, (short)3);
+ private static final org.apache.thrift.protocol.TField PORT_FIELD_DESC = new org.apache.thrift.protocol.TField("port", org.apache.thrift.protocol.TType.I32, (short)4);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new LSWorkerHeartbeatStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new LSWorkerHeartbeatTupleSchemeFactory());
+ }
+
+ private int time_secs; // required
+ private String topology_id; // required
+ private List<ExecutorInfo> executors; // required
+ private int port; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ TIME_SECS((short)1, "time_secs"),
+ TOPOLOGY_ID((short)2, "topology_id"),
+ EXECUTORS((short)3, "executors"),
+ PORT((short)4, "port");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // TIME_SECS
+ return TIME_SECS;
+ case 2: // TOPOLOGY_ID
+ return TOPOLOGY_ID;
+ case 3: // EXECUTORS
+ return EXECUTORS;
+ case 4: // PORT
+ return PORT;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __TIME_SECS_ISSET_ID = 0;
+ private static final int __PORT_ISSET_ID = 1;
+ private byte __isset_bitfield = 0;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.TIME_SECS, new org.apache.thrift.meta_data.FieldMetaData("time_secs", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.TOPOLOGY_ID, new org.apache.thrift.meta_data.FieldMetaData("topology_id", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.EXECUTORS, new org.apache.thrift.meta_data.FieldMetaData("executors", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ExecutorInfo.class))));
+ tmpMap.put(_Fields.PORT, new org.apache.thrift.meta_data.FieldMetaData("port", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(LSWorkerHeartbeat.class, metaDataMap);
+ }
+
+ public LSWorkerHeartbeat() {
+ }
+
+ public LSWorkerHeartbeat(
+ int time_secs,
+ String topology_id,
+ List<ExecutorInfo> executors,
+ int port)
+ {
+ this();
+ this.time_secs = time_secs;
+ set_time_secs_isSet(true);
+ this.topology_id = topology_id;
+ this.executors = executors;
+ this.port = port;
+ set_port_isSet(true);
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public LSWorkerHeartbeat(LSWorkerHeartbeat other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.time_secs = other.time_secs;
+ if (other.is_set_topology_id()) {
+ this.topology_id = other.topology_id;
+ }
+ if (other.is_set_executors()) {
+ List<ExecutorInfo> __this__executors = new ArrayList<ExecutorInfo>(other.executors.size());
+ for (ExecutorInfo other_element : other.executors) {
+ __this__executors.add(new ExecutorInfo(other_element));
+ }
+ this.executors = __this__executors;
+ }
+ this.port = other.port;
+ }
+
+ public LSWorkerHeartbeat deepCopy() {
+ return new LSWorkerHeartbeat(this);
+ }
+
+ @Override
+ public void clear() {
+ set_time_secs_isSet(false);
+ this.time_secs = 0;
+ this.topology_id = null;
+ this.executors = null;
+ set_port_isSet(false);
+ this.port = 0;
+ }
+
+ public int get_time_secs() {
+ return this.time_secs;
+ }
+
+ public void set_time_secs(int time_secs) {
+ this.time_secs = time_secs;
+ set_time_secs_isSet(true);
+ }
+
+ public void unset_time_secs() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIME_SECS_ISSET_ID);
+ }
+
+ /** Returns true if field time_secs is set (has been assigned a value) and false otherwise */
+ public boolean is_set_time_secs() {
+ return EncodingUtils.testBit(__isset_bitfield, __TIME_SECS_ISSET_ID);
+ }
+
+ public void set_time_secs_isSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIME_SECS_ISSET_ID, value);
+ }
+
+ public String get_topology_id() {
+ return this.topology_id;
+ }
+
+ public void set_topology_id(String topology_id) {
+ this.topology_id = topology_id;
+ }
+
+ public void unset_topology_id() {
+ this.topology_id = null;
+ }
+
+ /** Returns true if field topology_id is set (has been assigned a value) and false otherwise */
+ public boolean is_set_topology_id() {
+ return this.topology_id != null;
+ }
+
+ public void set_topology_id_isSet(boolean value) {
+ if (!value) {
+ this.topology_id = null;
+ }
+ }
+
+ public int get_executors_size() {
+ return (this.executors == null) ? 0 : this.executors.size();
+ }
+
+ public java.util.Iterator<ExecutorInfo> get_executors_iterator() {
+ return (this.executors == null) ? null : this.executors.iterator();
+ }
+
+ public void add_to_executors(ExecutorInfo elem) {
+ if (this.executors == null) {
+ this.executors = new ArrayList<ExecutorInfo>();
+ }
+ this.executors.add(elem);
+ }
+
+ public List<ExecutorInfo> get_executors() {
+ return this.executors;
+ }
+
+ public void set_executors(List<ExecutorInfo> executors) {
+ this.executors = executors;
+ }
+
+ public void unset_executors() {
+ this.executors = null;
+ }
+
+ /** Returns true if field executors is set (has been assigned a value) and false otherwise */
+ public boolean is_set_executors() {
+ return this.executors != null;
+ }
+
+ public void set_executors_isSet(boolean value) {
+ if (!value) {
+ this.executors = null;
+ }
+ }
+
+ public int get_port() {
+ return this.port;
+ }
+
+ public void set_port(int port) {
+ this.port = port;
+ set_port_isSet(true);
+ }
+
+ public void unset_port() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PORT_ISSET_ID);
+ }
+
+ /** Returns true if field port is set (has been assigned a value) and false otherwise */
+ public boolean is_set_port() {
+ return EncodingUtils.testBit(__isset_bitfield, __PORT_ISSET_ID);
+ }
+
+ public void set_port_isSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PORT_ISSET_ID, value);
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case TIME_SECS:
+ if (value == null) {
+ unset_time_secs();
+ } else {
+ set_time_secs((Integer)value);
+ }
+ break;
+
+ case TOPOLOGY_ID:
+ if (value == null) {
+ unset_topology_id();
+ } else {
+ set_topology_id((String)value);
+ }
+ break;
+
+ case EXECUTORS:
+ if (value == null) {
+ unset_executors();
+ } else {
+ set_executors((List<ExecutorInfo>)value);
+ }
+ break;
+
+ case PORT:
+ if (value == null) {
+ unset_port();
+ } else {
+ set_port((Integer)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case TIME_SECS:
+ return Integer.valueOf(get_time_secs());
+
+ case TOPOLOGY_ID:
+ return get_topology_id();
+
+ case EXECUTORS:
+ return get_executors();
+
+ case PORT:
+ return Integer.valueOf(get_port());
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case TIME_SECS:
+ return is_set_time_secs();
+ case TOPOLOGY_ID:
+ return is_set_topology_id();
+ case EXECUTORS:
+ return is_set_executors();
+ case PORT:
+ return is_set_port();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof LSWorkerHeartbeat)
+ return this.equals((LSWorkerHeartbeat)that);
+ return false;
+ }
+
+ public boolean equals(LSWorkerHeartbeat that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_time_secs = true;
+ boolean that_present_time_secs = true;
+ if (this_present_time_secs || that_present_time_secs) {
+ if (!(this_present_time_secs && that_present_time_secs))
+ return false;
+ if (this.time_secs != that.time_secs)
+ return false;
+ }
+
+ boolean this_present_topology_id = true && this.is_set_topology_id();
+ boolean that_present_topology_id = true && that.is_set_topology_id();
+ if (this_present_topology_id || that_present_topology_id) {
+ if (!(this_present_topology_id && that_present_topology_id))
+ return false;
+ if (!this.topology_id.equals(that.topology_id))
+ return false;
+ }
+
+ boolean this_present_executors = true && this.is_set_executors();
+ boolean that_present_executors = true && that.is_set_executors();
+ if (this_present_executors || that_present_executors) {
+ if (!(this_present_executors && that_present_executors))
+ return false;
+ if (!this.executors.equals(that.executors))
+ return false;
+ }
+
+ boolean this_present_port = true;
+ boolean that_present_port = true;
+ if (this_present_port || that_present_port) {
+ if (!(this_present_port && that_present_port))
+ return false;
+ if (this.port != that.port)
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ List<Object> list = new ArrayList<Object>();
+
+ boolean present_time_secs = true;
+ list.add(present_time_secs);
+ if (present_time_secs)
+ list.add(time_secs);
+
+ boolean present_topology_id = true && (is_set_topology_id());
+ list.add(present_topology_id);
+ if (present_topology_id)
+ list.add(topology_id);
+
+ boolean present_executors = true && (is_set_executors());
+ list.add(present_executors);
+ if (present_executors)
+ list.add(executors);
+
+ boolean present_port = true;
+ list.add(present_port);
+ if (present_port)
+ list.add(port);
+
+ return list.hashCode();
+ }
+
+ @Override
+ public int compareTo(LSWorkerHeartbeat other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(is_set_time_secs()).compareTo(other.is_set_time_secs());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (is_set_time_secs()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.time_secs, other.time_secs);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(is_set_topology_id()).compareTo(other.is_set_topology_id());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (is_set_topology_id()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.topology_id, other.topology_id);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(is_set_executors()).compareTo(other.is_set_executors());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (is_set_executors()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.executors, other.executors);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(is_set_port()).compareTo(other.is_set_port());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (is_set_port()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.port, other.port);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("LSWorkerHeartbeat(");
+ boolean first = true;
+
+ sb.append("time_secs:");
+ sb.append(this.time_secs);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("topology_id:");
+ if (this.topology_id == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.topology_id);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("executors:");
+ if (this.executors == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.executors);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("port:");
+ sb.append(this.port);
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!is_set_time_secs()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'time_secs' is unset! Struct:" + toString());
+ }
+
+ if (!is_set_topology_id()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'topology_id' is unset! Struct:" + toString());
+ }
+
+ if (!is_set_executors()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'executors' is unset! Struct:" + toString());
+ }
+
+ if (!is_set_port()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'port' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+ __isset_bitfield = 0;
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class LSWorkerHeartbeatStandardSchemeFactory implements SchemeFactory {
+ public LSWorkerHeartbeatStandardScheme getScheme() {
+ return new LSWorkerHeartbeatStandardScheme();
+ }
+ }
+
+ private static class LSWorkerHeartbeatStandardScheme extends StandardScheme<LSWorkerHeartbeat> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, LSWorkerHeartbeat struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // TIME_SECS
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.time_secs = iprot.readI32();
+ struct.set_time_secs_isSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // TOPOLOGY_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.topology_id = iprot.readString();
+ struct.set_topology_id_isSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // EXECUTORS
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list474 = iprot.readListBegin();
+ struct.executors = new ArrayList<ExecutorInfo>(_list474.size);
+ ExecutorInfo _elem475;
+ for (int _i476 = 0; _i476 < _list474.size; ++_i476)
+ {
+ _elem475 = new ExecutorInfo();
+ _elem475.read(iprot);
+ struct.executors.add(_elem475);
+ }
+ iprot.readListEnd();
+ }
+ struct.set_executors_isSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // PORT
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.port = iprot.readI32();
+ struct.set_port_isSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, LSWorkerHeartbeat struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(TIME_SECS_FIELD_DESC);
+ oprot.writeI32(struct.time_secs);
+ oprot.writeFieldEnd();
+ if (struct.topology_id != null) {
+ oprot.writeFieldBegin(TOPOLOGY_ID_FIELD_DESC);
+ oprot.writeString(struct.topology_id);
+ oprot.writeFieldEnd();
+ }
+ if (struct.executors != null) {
+ oprot.writeFieldBegin(EXECUTORS_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.executors.size()));
+ for (ExecutorInfo _iter477 : struct.executors)
+ {
+ _iter477.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldBegin(PORT_FIELD_DESC);
+ oprot.writeI32(struct.port);
+ oprot.writeFieldEnd();
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class LSWorkerHeartbeatTupleSchemeFactory implements SchemeFactory {
+ public LSWorkerHeartbeatTupleScheme getScheme() {
+ return new LSWorkerHeartbeatTupleScheme();
+ }
+ }
+
+ private static class LSWorkerHeartbeatTupleScheme extends TupleScheme<LSWorkerHeartbeat> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, LSWorkerHeartbeat struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.time_secs);
+ oprot.writeString(struct.topology_id);
+ {
+ oprot.writeI32(struct.executors.size());
+ for (ExecutorInfo _iter478 : struct.executors)
+ {
+ _iter478.write(oprot);
+ }
+ }
+ oprot.writeI32(struct.port);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, LSWorkerHeartbeat struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.time_secs = iprot.readI32();
+ struct.set_time_secs_isSet(true);
+ struct.topology_id = iprot.readString();
+ struct.set_topology_id_isSet(true);
+ {
+ org.apache.thrift.protocol.TList _list479 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.executors = new ArrayList<ExecutorInfo>(_list479.size);
+ ExecutorInfo _elem480;
+ for (int _i481 = 0; _i481 < _list479.size; ++_i481)
+ {
+ _elem480 = new ExecutorInfo();
+ _elem480.read(iprot);
+ struct.executors.add(_elem480);
+ }
+ }
+ struct.set_executors_isSet(true);
+ struct.port = iprot.readI32();
+ struct.set_port_isSet(true);
+ }
+ }
+
+}
+