Tabnine Logo
ClusterUtils.maybeDeserialize
Code IndexAdd Tabnine to your IDE (free)

How to use
maybeDeserialize
method
in
org.apache.storm.cluster.ClusterUtils

Best Java code snippets using org.apache.storm.cluster.ClusterUtils.maybeDeserialize (Showing top 20 results out of 315)

origin: apache/storm

@Override
public void syncRemoteAssignments(Map<String, byte[]> remote) {
  Map<String, Assignment> tmp = new ConcurrentHashMap<>();
  for (Map.Entry<String, byte[]> entry : remote.entrySet()) {
    tmp.put(entry.getKey(), ClusterUtils.maybeDeserialize(entry.getValue(), Assignment.class));
  }
  this.idToAssignment = tmp;
}
origin: apache/storm

@Override
public LogConfig topologyLogConfig(String stormId, Runnable cb) {
  if (cb != null) {
    logConfigCallback.put(stormId, cb);
  }
  String path = ClusterUtils.logConfigPath(stormId);
  return ClusterUtils.maybeDeserialize(stateStorage.get_data(path, cb != null), LogConfig.class);
}
origin: apache/storm

@Override
public StormBase stormBase(String stormId, Runnable callback) {
  if (callback != null) {
    stormBaseCallback.put(stormId, callback);
  }
  return ClusterUtils.maybeDeserialize(stateStorage.get_data(ClusterUtils.stormPath(stormId), callback != null), StormBase.class);
}
origin: apache/storm

@Override
public Assignment remoteAssignmentInfo(String stormId, Runnable callback) {
  if (callback != null) {
    assignmentInfoCallback.put(stormId, callback);
  }
  byte[] serialized = stateStorage.get_data(ClusterUtils.assignmentPath(stormId), callback != null);
  return ClusterUtils.maybeDeserialize(serialized, Assignment.class);
}
origin: apache/storm

@Override
public Credentials credentials(String stormId, Runnable callback) {
  if (callback != null) {
    credentialsCallback.put(stormId, callback);
  }
  String path = ClusterUtils.credentialsPath(stormId);
  return ClusterUtils.maybeDeserialize(stateStorage.get_data(path, callback != null), Credentials.class);
}
origin: apache/storm

@Override
public SupervisorInfo supervisorInfo(String supervisorId) {
  String path = ClusterUtils.supervisorPath(supervisorId);
  return ClusterUtils.maybeDeserialize(stateStorage.get_data(path, false), SupervisorInfo.class);
}
origin: apache/storm

@Override
public ClusterWorkerHeartbeat getWorkerHeartbeat(String stormId, String node, Long port) {
  byte[] bytes = stateStorage.get_worker_hb(ClusterUtils.workerbeatPath(stormId, node, port), false);
  return ClusterUtils.maybeDeserialize(bytes, ClusterWorkerHeartbeat.class);
}
origin: apache/storm

@Override
public List<NimbusSummary> nimbuses() {
  List<NimbusSummary> nimbusSummaries = new ArrayList<>();
  List<String> nimbusIds = stateStorage.get_children(ClusterUtils.NIMBUSES_SUBTREE, false);
  for (String nimbusId : nimbusIds) {
    byte[] serialized = stateStorage.get_data(ClusterUtils.nimbusPath(nimbusId), false);
    // check for null which can exist because of a race condition in which nimbus nodes in zk may have been
    // removed when connections are reconnected after getting children in the above line
    if (serialized != null) {
      NimbusSummary nimbusSummary = ClusterUtils.maybeDeserialize(serialized, NimbusSummary.class);
      nimbusSummaries.add(nimbusSummary);
    }
  }
  return nimbusSummaries;
}
origin: apache/storm

@Override
public ErrorInfo lastError(String stormId, String componentId) {
  String path = ClusterUtils.lastErrorPath(stormId, componentId);
  if (stateStorage.node_exists(path, false)) {
    ErrorInfo errorInfo = ClusterUtils.maybeDeserialize(stateStorage.get_data(path, false), ErrorInfo.class);
    return errorInfo;
  }
  return null;
}
origin: apache/storm

@Override
public PrivateWorkerKey getPrivateWorkerKey(WorkerTokenServiceType type, String topologyId, long keyVersion) {
  String path = ClusterUtils.secretKeysPath(type, topologyId, keyVersion);
  byte[] data = stateStorage.get_data(path, false);
  if (data == null) {
    LOG.debug("Could not find entry at {} will sync to see if that fixes it", path);
    //We didn't find it, but there are races, so we want to check again after a sync
    stateStorage.sync_path(path);
    data = stateStorage.get_data(path, false);
  }
  return ClusterUtils.maybeDeserialize(data, PrivateWorkerKey.class);
}
origin: apache/storm

@Override
public List<ErrorInfo> errors(String stormId, String componentId) {
  List<ErrorInfo> errorInfos = new ArrayList<>();
  String path = ClusterUtils.errorPath(stormId, componentId);
  if (stateStorage.node_exists(path, false)) {
    List<String> childrens = stateStorage.get_children(path, false);
    for (String child : childrens) {
      String childPath = path + ClusterUtils.ZK_SEPERATOR + child;
      ErrorInfo errorInfo = ClusterUtils.maybeDeserialize(stateStorage.get_data(childPath, false), ErrorInfo.class);
      if (errorInfo != null) {
        errorInfos.add(errorInfo);
      }
    }
  }
  Collections.sort(errorInfos, new Comparator<ErrorInfo>() {
    public int compare(ErrorInfo arg0, ErrorInfo arg1) {
      return Integer.compare(arg1.get_error_time_secs(), arg0.get_error_time_secs());
    }
  });
  return errorInfos;
}
origin: apache/storm

@Override
public List<ProfileRequest> getTopologyProfileRequests(String stormId) {
  List<ProfileRequest> profileRequests = new ArrayList<>();
  String path = ClusterUtils.profilerConfigPath(stormId);
  if (stateStorage.node_exists(path, false)) {
    List<String> strs = stateStorage.get_children(path, false);
    for (String str : strs) {
      String childPath = path + ClusterUtils.ZK_SEPERATOR + str;
      byte[] raw = stateStorage.get_data(childPath, false);
      ProfileRequest request = ClusterUtils.maybeDeserialize(raw, ProfileRequest.class);
      if (request != null) {
        profileRequests.add(request);
      }
    }
  }
  return profileRequests;
}
origin: apache/storm

@Override
public VersionedData<Assignment> assignmentInfoWithVersion(String stormId, Runnable callback) {
  if (callback != null) {
    assignmentInfoWithVersionCallback.put(stormId, callback);
  }
  Assignment assignment = null;
  Integer version = 0;
  VersionedData<byte[]> dataWithVersion = stateStorage.get_data_with_version(ClusterUtils.assignmentPath(stormId), callback != null);
  if (dataWithVersion != null) {
    assignment = ClusterUtils.maybeDeserialize(dataWithVersion.getData(), Assignment.class);
    version = dataWithVersion.getVersion();
  }
  return new VersionedData<Assignment>(version, assignment);
}
origin: apache/storm

@Override
public void removeExpiredPrivateWorkerKeys(String topologyId) {
  for (WorkerTokenServiceType type : WorkerTokenServiceType.values()) {
    String basePath = ClusterUtils.secretKeysPath(type, topologyId);
    try {
      for (String version : stateStorage.get_children(basePath, false)) {
        String fullPath = basePath + ClusterUtils.ZK_SEPERATOR + version;
        try {
          PrivateWorkerKey key =
            ClusterUtils.maybeDeserialize(stateStorage.get_data(fullPath, false), PrivateWorkerKey.class);
          if (Time.currentTimeMillis() > key.get_expirationTimeMillis()) {
            LOG.info("Removing expired worker key {}", fullPath);
            stateStorage.delete_node(fullPath);
          }
        } catch (RuntimeException e) {
          //This should never happen because only the primary nimbus is active, but just in case
          // declare the race safe, even if we lose it.
          if (!Utils.exceptionCauseIsInstanceOf(KeeperException.NoNodeException.class, e)) {
            throw e;
          }
        }
      }
    } catch (RuntimeException e) {
      //No node for basePath is OK, nothing to remove
      if (!Utils.exceptionCauseIsInstanceOf(KeeperException.NoNodeException.class, e)) {
        throw e;
      }
    }
  }
}
origin: org.apache.storm/storm-core

@Override
public Assignment assignmentInfo(String stormId, Runnable callback) {
  if (callback != null) {
    assignmentInfoCallback.put(stormId, callback);
  }
  byte[] serialized = stateStorage.get_data(ClusterUtils.assignmentPath(stormId), callback != null);
  return ClusterUtils.maybeDeserialize(serialized, Assignment.class);
}
origin: org.apache.storm/storm-core

@Override
public StormBase stormBase(String stormId, Runnable callback) {
  if (callback != null) {
    stormBaseCallback.put(stormId, callback);
  }
  return ClusterUtils.maybeDeserialize(stateStorage.get_data(ClusterUtils.stormPath(stormId), callback != null), StormBase.class);
}
origin: org.apache.storm/storm-core

@Override
public LogConfig topologyLogConfig(String stormId, Runnable cb) {
  if (cb != null){
    logConfigCallback.put(stormId, cb);
  }
  String path = ClusterUtils.logConfigPath(stormId);
  return ClusterUtils.maybeDeserialize(stateStorage.get_data(path, cb != null), LogConfig.class);
}
origin: org.apache.storm/storm-core

@Override
public ClusterWorkerHeartbeat getWorkerHeartbeat(String stormId, String node, Long port) {
  byte[] bytes = stateStorage.get_worker_hb(ClusterUtils.workerbeatPath(stormId, node, port), false);
  return ClusterUtils.maybeDeserialize(bytes, ClusterWorkerHeartbeat.class);
}
origin: org.apache.storm/storm-core

@Override
public SupervisorInfo supervisorInfo(String supervisorId) {
  String path = ClusterUtils.supervisorPath(supervisorId);
  return ClusterUtils.maybeDeserialize(stateStorage.get_data(path, false), SupervisorInfo.class);
}
origin: org.apache.storm/storm-core

@Override
public ErrorInfo lastError(String stormId, String componentId) {
  String path = ClusterUtils.lastErrorPath(stormId, componentId);
  if (stateStorage.node_exists(path, false)) {
    ErrorInfo errorInfo = ClusterUtils.maybeDeserialize(stateStorage.get_data(path, false), ErrorInfo.class);
    return errorInfo;
  }
  return null;
}
org.apache.storm.clusterClusterUtilsmaybeDeserialize

Popular methods of ClusterUtils

  • mkStormClusterState
  • errorStormRoot
  • assignmentPath
  • backpressurePath
  • backpressureStormRoot
  • blobstoreMaxKeySequenceNumberPath
  • blobstorePath
  • convertExecutorBeats
    Ensures that we only return heartbeats for executors assigned to this worker
  • credentialsPath
  • errorPath
  • lastErrorPath
  • logConfigPath
  • lastErrorPath,
  • logConfigPath,
  • mkStateStorage,
  • mkStateStorageImpl,
  • mkStormClusterStateImpl,
  • mkTopoAcls,
  • mkTopoReadOnlyAcls,
  • mkTopoReadWriteAcls,
  • nimbusPath

Popular in Java

  • Reading from database using SQL prepared statement
  • getSystemService (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setScale (BigDecimal)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • Kernel (java.awt.image)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now