Github user unsleepy22 commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1445#discussion_r73174655
  
    --- Diff: storm-core/src/jvm/org/apache/storm/executor/Executor.java ---
    @@ -0,0 +1,575 @@
    +/**
    + * 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.
    + */
    +package org.apache.storm.executor;
    +
    +import clojure.lang.IFn;
    +import com.google.common.annotations.VisibleForTesting;
    +import com.google.common.collect.Lists;
    +import com.lmax.disruptor.EventHandler;
    +import com.lmax.disruptor.dsl.ProducerType;
    +import java.io.IOException;
    +import java.net.UnknownHostException;
    +import java.util.ArrayList;
    +import java.util.HashMap;
    +import java.util.List;
    +import java.util.Map;
    +import java.util.Random;
    +import java.util.concurrent.atomic.AtomicBoolean;
    +import java.util.concurrent.atomic.AtomicReference;
    +import org.apache.storm.Config;
    +import org.apache.storm.Constants;
    +import org.apache.storm.StormTimer;
    +import org.apache.storm.cluster.ClusterStateContext;
    +import org.apache.storm.cluster.ClusterUtils;
    +import org.apache.storm.cluster.DaemonType;
    +import org.apache.storm.cluster.IStormClusterState;
    +import org.apache.storm.daemon.GrouperFactory;
    +import org.apache.storm.daemon.StormCommon;
    +import org.apache.storm.daemon.Task;
    +import org.apache.storm.executor.bolt.BoltExecutor;
    +import org.apache.storm.executor.error.IReportError;
    +import org.apache.storm.executor.error.ReportError;
    +import org.apache.storm.executor.error.ReportErrorAndDie;
    +import org.apache.storm.executor.spout.SpoutExecutor;
    +import org.apache.storm.generated.Bolt;
    +import org.apache.storm.generated.DebugOptions;
    +import org.apache.storm.generated.Grouping;
    +import org.apache.storm.generated.SpoutSpec;
    +import org.apache.storm.generated.StormTopology;
    +import org.apache.storm.grouping.LoadAwareCustomStreamGrouping;
    +import org.apache.storm.metric.api.IMetric;
    +import org.apache.storm.metric.api.IMetricsConsumer;
    +import org.apache.storm.stats.BoltExecutorStats;
    +import org.apache.storm.stats.CommonStats;
    +import org.apache.storm.stats.SpoutExecutorStats;
    +import org.apache.storm.stats.StatsUtil;
    +import org.apache.storm.task.WorkerTopologyContext;
    +import org.apache.storm.tuple.AddressedTuple;
    +import org.apache.storm.tuple.Fields;
    +import org.apache.storm.tuple.Tuple;
    +import org.apache.storm.tuple.TupleImpl;
    +import org.apache.storm.tuple.Values;
    +import org.apache.storm.utils.ConfigUtils;
    +import org.apache.storm.utils.DisruptorBackpressureCallback;
    +import org.apache.storm.utils.DisruptorQueue;
    +import org.apache.storm.utils.Time;
    +import org.apache.storm.utils.Utils;
    +import org.apache.storm.utils.WorkerBackpressureThread;
    +import org.json.simple.JSONValue;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.util.concurrent.Callable;
    +
    +public abstract class Executor implements Callable, EventHandler {
    +
    +    private static final Logger LOG = 
LoggerFactory.getLogger(Executor.class);
    +
    +    protected final Map workerData;
    +    protected final WorkerTopologyContext workerTopologyContext;
    +    protected final List<Long> executorId;
    +    protected final List<Integer> taskIds;
    +    protected final String componentId;
    +    protected final AtomicBoolean openOrPrepareWasCalled;
    +    protected final Map stormConf;
    +    protected final Map conf;
    +    protected final String stormId;
    +    protected final HashMap sharedExecutorData;
    +    protected final AtomicBoolean stormActive;
    +    protected final AtomicReference<Map<String, DebugOptions>> 
stormComponentDebug;
    +    protected final Runnable suicideFn;
    +    protected final IStormClusterState stormClusterState;
    +    protected final Map<Integer, String> taskToComponent;
    +    protected CommonStats stats;
    +    protected final Map<Integer, Map<Integer, Map<String, IMetric>>> 
intervalToTaskToMetricToRegistry;
    +    protected final Map<String, Map<String, 
LoadAwareCustomStreamGrouping>> streamToComponentToGrouper;
    +    protected final ReportErrorAndDie reportErrorDie;
    +    protected final Callable<Boolean> sampler;
    +    protected final AtomicBoolean backpressure;
    +    protected ExecutorTransfer executorTransfer;
    +    protected final String type;
    +    protected final AtomicBoolean throttleOn;
    +    protected IFn transferFn;
    +
    +    protected final IReportError reportError;
    +    protected final Random rand;
    +    protected final DisruptorQueue transferQueue;
    +    protected final DisruptorQueue receiveQueue;
    +    protected Map<Integer, Task> idToTask;
    +    protected final Map<String, String> credentials;
    +    protected final Boolean isDebug;
    +    protected final Boolean isEventLoggers;
    +    protected String hostname;
    +
    +    protected Executor(Map workerData, List<Long> executorId, Map<String, 
String> credentials) {
    +        this.workerData = workerData;
    +        this.executorId = executorId;
    +        this.workerTopologyContext = 
StormCommon.makeWorkerContext(workerData);
    +        this.taskIds = StormCommon.executorIdToTasks(executorId);
    +        this.componentId = 
workerTopologyContext.getComponentId(taskIds.get(0));
    +        this.openOrPrepareWasCalled = new AtomicBoolean(false);
    +        this.stormConf = normalizedComponentConf((Map) 
workerData.get(Constants.STORM_CONF), workerTopologyContext, componentId);
    +        this.receiveQueue = (DisruptorQueue) (((Map) 
workerData.get(Constants.EXECUTOR_RECEIVE_QUEUE_MAP)).get(executorId));
    +        this.stormId = (String) workerData.get(Constants.STORM_ID);
    +        this.conf = (Map) workerData.get(Constants.CONF);
    +        this.sharedExecutorData = new HashMap();
    +        this.stormActive = (AtomicBoolean) 
workerData.get(Constants.STORM_ACTIVE_ATOM);
    +        this.stormComponentDebug = (AtomicReference<Map<String, 
DebugOptions>>) workerData.get(Constants.COMPONENT_TO_DEBUG_ATOM);
    +
    +        this.transferQueue = mkExecutorBatchQueue(stormConf, executorId);
    +        this.transferFn = (IFn) workerData.get(Constants.TRANSFER_FN);
    +        this.executorTransfer = new 
ExecutorTransfer(workerTopologyContext, transferQueue, stormConf, transferFn);
    +
    +        this.suicideFn = (Runnable) workerData.get(Constants.SUICIDE_FN);
    +        try {
    +            this.stormClusterState = 
ClusterUtils.mkStormClusterState(workerData.get("state-store"), 
Utils.getWorkerACL(stormConf),
    +                    new ClusterStateContext(DaemonType.SUPERVISOR));
    --- End diff --
    
    addressed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to