本文整理汇总了Java中backtype.storm.utils.LocalState类的典型用法代码示例。如果您正苦于以下问题:Java LocalState类的具体用法?Java LocalState怎么用?Java LocalState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LocalState类属于backtype.storm.utils包,在下文中一共展示了LocalState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WorkerHeartbeatRunable
import backtype.storm.utils.LocalState; //导入依赖的package包/类
public WorkerHeartbeatRunable(WorkerData workerData) {
this.workerData = workerData;
this.conf = workerData.getStormConf();
this.worker_id = workerData.getWorkerId();
this.port = workerData.getPort();
this.topologyId = workerData.getTopologyId();
this.task_ids = new CopyOnWriteArraySet<Integer>(workerData.getTaskids());
this.shutdown = workerData.getShutdown();
String key = Config.WORKER_HEARTBEAT_FREQUENCY_SECS;
frequence = JStormUtils.parseInt(conf.get(key), 10);
this.workerStates = new HashMap<String, LocalState>();
}
示例2: SyncProcessEvent
import backtype.storm.utils.LocalState; //导入依赖的package包/类
/**
* @param conf
* @param localState
* @param workerThreadPids
* @param supervisorId
* @param sharedContext
* @param workerThreadPidsReadLock
* @param workerThreadPidsWriteLock
*/
public SyncProcessEvent(String supervisorId, Map conf,
LocalState localState,
ConcurrentHashMap<String, String> workerThreadPids,
IContext sharedContext) {
this.supervisorId = supervisorId;
this.conf = conf;
this.localState = localState;
this.workerThreadPids = workerThreadPids;
// right now, sharedContext is null
this.sharedContext = sharedContext;
this.sandBoxMaker = new SandBoxMaker(conf);
if (ConfigExtension.isEnableCgroup(conf)) {
cgroupManager = new CgroupManager(conf);
}
}
示例3: SyncProcessEvent
import backtype.storm.utils.LocalState; //导入依赖的package包/类
public SyncProcessEvent(String supervisorId, Map conf, LocalState localState,
ConcurrentHashMap<String, String> workerThreadPids,
IContext sharedContext, WorkerReportError workerReportError,
StormClusterState stormClusterState) {
this.supervisorId = supervisorId;
this.conf = conf;
this.localState = localState;
this.workerThreadPids = workerThreadPids;
// right now, sharedContext is null
this.sharedContext = sharedContext;
this.sandBoxMaker = new SandBoxMaker(conf);
this.workerIdToStartTimeAndPort = new HashMap<>();
this.needDownloadTopologies = new AtomicReference<>();
this.isJstormOnYarn = JStormUtils.parseBoolean(System.getProperty("jstorm-on-yarn"), false) ||
ConfigExtension.isJStormOnYarn(conf);
if (ConfigExtension.isEnableCgroup(conf)) {
cgroupManager = new CgroupManager(conf);
}
this.killingWorkers = new HashMap<>();
this.upgradingTopologyPorts = new HashMap<>();
this.workerReportError = workerReportError;
this.stormClusterState = stormClusterState;
}
示例4: Heartbeat
import backtype.storm.utils.LocalState; //导入依赖的package包/类
@SuppressWarnings({"rawtypes", "unchecked"})
public Heartbeat(Map conf, StormClusterState stormClusterState, String supervisorId,
LocalState localState) {
String myHostName = JStormServerUtils.getHostName(conf);
this.stormClusterState = stormClusterState;
this.supervisorId = supervisorId;
this.conf = conf;
this.myHostName = myHostName;
this.startTime = TimeUtils.current_time_secs();
this.frequency = JStormUtils.parseInt(conf.get(Config.SUPERVISOR_HEARTBEAT_FREQUENCY_SECS));
this.hbUpdateTrigger = new AtomicBoolean(true);
this.localState = localState;
this.healthStatus = HealthStatus.INFO;
initSupervisorInfo(conf);
LOG.info("Successfully inited supervisor heartbeat thread, " + supervisorInfo);
}
示例5: readWorkerHeartbeat
import backtype.storm.utils.LocalState; //导入依赖的package包/类
/**
* get worker heartbeat by workerid
*
* @param conf
* @param workerId
* @returns WorkerHeartbeat
* @throws IOException
*/
public WorkerHeartbeat readWorkerHeartbeat(Map conf, String workerId)
throws Exception {
try {
LocalState ls = StormConfig.worker_state(conf, workerId);
return (WorkerHeartbeat) ls.get(Common.LS_WORKER_HEARTBEAT);
} catch (IOException e) {
LOG.error("Failed to get worker Heartbeat", e);
return null;
}
}
示例6: SyncSupervisorEvent
import backtype.storm.utils.LocalState; //导入依赖的package包/类
/**
* @param conf
* @param processEventManager
* @param syncSupEventManager
* @param stormClusterState
* @param supervisorId
* @param localState
* @param syncProcesses
*/
public SyncSupervisorEvent(String supervisorId, Map conf,
EventManager processEventManager, EventManager syncSupEventManager,
StormClusterState stormClusterState, LocalState localState,
SyncProcessEvent syncProcesses) {
this.syncProcesses = syncProcesses;
this.processEventManager = processEventManager;
this.syncSupEventManager = syncSupEventManager;
this.stormClusterState = stormClusterState;
this.conf = conf;
this.supervisorId = supervisorId;
this.localState = localState;
}
示例7: worker_state
import backtype.storm.utils.LocalState; //导入依赖的package包/类
public static LocalState worker_state(Map conf, String id)
throws IOException {
String path = worker_heartbeats_root(conf, id);
LocalState rtn = new LocalState(path);
return rtn;
}
示例8: readWorkerHeartbeat
import backtype.storm.utils.LocalState; //导入依赖的package包/类
/**
* get worker heartbeat by workerid
*
* @param conf
* @param workerId
* @returns WorkerHeartbeat
* @throws IOException
*/
public WorkerHeartbeat readWorkerHeartbeat(Map conf, String workerId) throws Exception {
try {
LocalState ls = StormConfig.worker_state(conf, workerId);
return (WorkerHeartbeat) ls.get(Common.LS_WORKER_HEARTBEAT);
} catch (Exception e) {
LOG.error("Failed to get worker Heartbeat", e);
return null;
}
}
示例9: SyncSupervisorEvent
import backtype.storm.utils.LocalState; //导入依赖的package包/类
/**
* @param conf
* @param processEventManager
* @param syncSupEventManager
* @param stormClusterState
* @param supervisorId
* @param localState
* @param syncProcesses
*/
public SyncSupervisorEvent(String supervisorId, Map conf, EventManager processEventManager, EventManager syncSupEventManager,
StormClusterState stormClusterState, LocalState localState, SyncProcessEvent syncProcesses, Heartbeat heartbeat) {
this.syncProcesses = syncProcesses;
this.processEventManager = processEventManager;
this.syncSupEventManager = syncSupEventManager;
this.stormClusterState = stormClusterState;
this.conf = conf;
this.supervisorId = supervisorId;
this.localState = localState;
this.heartbeat = heartbeat;
}
示例10: getWorkerState
import backtype.storm.utils.LocalState; //导入依赖的package包/类
private LocalState getWorkerState() throws IOException {
LocalState state = workerStates.get(worker_id);
if (state == null) {
state = StormConfig.worker_state(conf, worker_id);
workerStates.put(worker_id, state);
}
return state;
}
示例11: readWorkerHeartbeat
import backtype.storm.utils.LocalState; //导入依赖的package包/类
/**
* get worker heartbeat by workerId
*
* @param conf conf
* @param workerId worker id
* @return WorkerHeartbeat
*/
public WorkerHeartbeat readWorkerHeartbeat(Map conf, String workerId) throws Exception {
try {
LocalState ls = StormConfig.worker_state(conf, workerId);
return (WorkerHeartbeat) ls.get(Common.LS_WORKER_HEARTBEAT);
} catch (Exception e) {
LOG.error("Failed to get heartbeat for worker:{}", workerId, e);
return null;
}
}
示例12: SyncSupervisorEvent
import backtype.storm.utils.LocalState; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public SyncSupervisorEvent(String supervisorId, Map conf, EventManager syncSupEventManager,
StormClusterState stormClusterState, LocalState localState,
SyncProcessEvent syncProcesses, Heartbeat heartbeat) {
this.syncProcesses = syncProcesses;
this.syncSupEventManager = syncSupEventManager;
this.stormClusterState = stormClusterState;
this.conf = conf;
this.supervisorId = supervisorId;
this.localState = localState;
this.heartbeat = heartbeat;
}
示例13: getWorkerState
import backtype.storm.utils.LocalState; //导入依赖的package包/类
private LocalState getWorkerState() throws IOException {
LocalState state = workerStates.get(workerId);
if (state == null) {
state = StormConfig.worker_state(conf, workerId);
workerStates.put(workerId, state);
}
return state;
}
示例14: doHeartbeat
import backtype.storm.utils.LocalState; //导入依赖的package包/类
/**
* do heartbeat and update LocalState
*/
public void doHeartbeat() throws IOException {
int curTime = TimeUtils.current_time_secs();
WorkerHeartbeat hb = new WorkerHeartbeat(curTime, topologyId, taskIds, port);
LOG.debug("Doing heartbeat:" + workerId + ",port:" + port + ",hb" + hb.toString());
LocalState state = getWorkerState();
state.put(Common.LS_WORKER_HEARTBEAT, hb);
}
示例15: LocalStateShim
import backtype.storm.utils.LocalState; //导入依赖的package包/类
public LocalStateShim(String localDir) throws IOException {
_state = new LocalState(localDir);
}