org.apache.storm.utils.Utils.uuid()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(191)

本文整理了Java中org.apache.storm.utils.Utils.uuid()方法的一些代码示例,展示了Utils.uuid()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.uuid()方法的具体详情如下:
包路径:org.apache.storm.utils.Utils
类名称:Utils
方法名:uuid

Utils.uuid介绍

暂无

代码示例

代码示例来源:origin: apache/storm

@Override
public String beginFileUpload() throws AuthorizationException, TException {
  //Just ignore these for now.  We are going to throw it away anyways
  return Utils.uuid();
}

代码示例来源:origin: apache/storm

/**
 * A tracked cluster can run tracked topologies. See {@link org.apache.storm.testing.TrackedTopology} for more information on
 * tracked topologies.
 */
public Builder withTracked() {
  this.trackId = Utils.uuid();
  return this;
}

代码示例来源:origin: apache/storm

public LocalContainer(Map<String, Object> conf, String supervisorId, int supervisorPort, int port,
           LocalAssignment assignment, IContext sharedContext, StormMetricsRegistry metricsRegistry,
           ContainerMemoryTracker containerMemoryTracker) throws IOException {
  super(ContainerType.LAUNCH, conf, supervisorId, supervisorPort, port, assignment, null, null, null, null, metricsRegistry, 
    containerMemoryTracker);
  _sharedContext = sharedContext;
  _workerId = Utils.uuid();
}

代码示例来源:origin: apache/storm

public String generateSupervisorId() {
    String extraPart = "";
    try {
      extraPart = "-" + InetAddress.getLocalHost().getHostAddress();
    } catch (UnknownHostException e) {
      // This should not happen (localhost), but if it does we are still OK
    }
    return Utils.uuid() + extraPart;
  }
}

代码示例来源:origin: apache/storm

/**
   * Create a new request for a shared memory region off heap between workers on a node
   *
   * @param amount the number of MB to share
   * @param name   the name of the shared region (for tracking purposes)
   */
  public SharedOffHeapWithinNode(double amount, String name) {
    super(name == null ? Utils.uuid() : name);
    set_off_heap_node(amount);
  }
}

代码示例来源:origin: apache/storm

/**
   * Create a new request for a shared memory region off heap within a worker
   *
   * @param amount the number of MB to share
   * @param name   the name of the shared region (for tracking purposes)
   */
  public SharedOffHeapWithinWorker(double amount, String name) {
    super(name == null ? Utils.uuid() : name);
    set_off_heap_worker(amount);
  }
}

代码示例来源:origin: apache/storm

public static String localTempPath() {
  StringBuilder ret = new StringBuilder().append(System.getProperty("java.io.tmpdir"));
  if (!Utils.isOnWindows()) {
    ret.append("/");
  }
  ret.append(Utils.uuid());
  return ret.toString();
}

代码示例来源:origin: apache/storm

/**
   * Create a new request for a shared memory region on heap
   *
   * @param amount the number of MB to share on heap
   * @param name   the name of the shared region (for tracking purposes)
   */
  public SharedOnHeap(double amount, String name) {
    super(name == null ? Utils.uuid() : name);
    set_on_heap(amount);
  }
}

代码示例来源:origin: apache/storm

/**
 * Run with a local tracked cluster
 * @deprecated use ```
 * try (LocalCluster cluster = new LocalCluster.Builder().withTracked()....build()) {
 *  ...
 * }
 * ```
 * @param param configs to set in the cluster
 * @param code what to run
 */
@Deprecated
public static void withTrackedCluster(MkClusterParam param, TestJob code) {
  try (LocalCluster lc = cluster(param, Utils.uuid(), true)) {
    code.run(lc);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: apache/storm

@SuppressWarnings("deprecation")
@Override
public String beginUpdateBlob(String key) throws AuthorizationException, KeyNotFoundException, TException {
  try {
    String sessionId = Utils.uuid();
    blobUploaders.put(sessionId, blobStore.updateBlob(key, getSubject()));
    LOG.info("Created upload session for {}", key);
    return sessionId;
  } catch (Exception e) {
    LOG.warn("begin update blob exception.", e);
    if (e instanceof TException) {
      throw (TException) e;
    }
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: apache/storm

@SuppressWarnings("deprecation")
@Override
public String beginCreateBlob(String key, SettableBlobMeta meta)
  throws AuthorizationException, KeyAlreadyExistsException, TException {
  try {
    String sessionId = Utils.uuid();
    blobUploaders.put(sessionId, blobStore.createBlob(key, meta, getSubject()));
    LOG.info("Created blob {} for session {}", key, sessionId);
    return sessionId;
  } catch (Exception e) {
    LOG.warn("begin create blob exception.", e);
    if (e instanceof TException) {
      throw (TException) e;
    }
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: apache/storm

@SuppressWarnings("deprecation")
@Override
public String beginFileUpload() throws AuthorizationException, TException {
  try {
    beginFileUploadCalls.mark();
    assertIsLeader();
    checkAuthorization(null, null, "fileUpload");
    String fileloc = getInbox() + "/stormjar-" + Utils.uuid() + ".jar";
    uploaders.put(fileloc, new TimedWritableByteChannel(Channels.newChannel(new FileOutputStream(fileloc)), fileUploadDuration));
    LOG.info("Uploading file from client to {}", fileloc);
    return fileloc;
  } catch (Exception e) {
    LOG.warn("Begin file upload exception", e);
    if (e instanceof TException) {
      throw (TException) e;
    }
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: apache/storm

/**
 * Create a new worker ID for this process and store in in this object and in the local state.  Never call this if a worker is currently
 * up and running. We will lose track of the process.
 */
protected void createNewWorkerId() {
  _type.assertFull();
  assert (_workerId == null);
  synchronized (_localState) {
    _workerId = Utils.uuid();
    Map<String, Integer> workerToPort = _localState.getApprovedWorkers();
    if (workerToPort == null) {
      workerToPort = new HashMap<>(1);
    }
    removeWorkersOn(workerToPort, _port);
    workerToPort.put(_workerId, _port);
    _localState.setApprovedWorkers(workerToPort);
    LOG.info("Created Worker ID {}", _workerId);
  }
}

代码示例来源:origin: apache/storm

session = Utils.uuid();
} else {
  keyIt = blobListers.get(session);

代码示例来源:origin: apache/storm

superConf.put(DaemonConfig.SUPERVISOR_SLOTS_PORTS, portNumbers);
final String superId = id == null ? Utils.uuid() : id;
ISupervisor isuper = new StandaloneSupervisor() {
  @Override

代码示例来源:origin: apache/storm

/**
 * Same as schedule with millisecond resolution.
 *
 * @param delayMs     the number of milliseconds to delay before running the function
 * @param func        the function to run
 * @param checkActive whether to check is the timer is active
 * @param jitterMs    add jitter to the run
 */
public void scheduleMs(long delayMs, Runnable func, boolean checkActive, int jitterMs) {
  if (func == null) {
    throw new RuntimeException("function to schedule is null!");
  }
  if (checkActive) {
    checkActive();
  }
  String id = Utils.uuid();
  long endTimeMs = Time.currentTimeMillis() + delayMs;
  if (jitterMs > 0) {
    endTimeMs = this.task.random.nextInt(jitterMs) + endTimeMs;
  }
  task.add(new QueueEntry(endTimeMs, func, id));
}

代码示例来源:origin: apache/storm

@SuppressWarnings("deprecation")
@Override
public BeginDownloadResult beginBlobDownload(String key)
  throws AuthorizationException, KeyNotFoundException, TException {
  try {
    InputStreamWithMeta is = blobStore.getBlob(key, getSubject());
    String sessionId = Utils.uuid();
    BeginDownloadResult ret = new BeginDownloadResult(is.getVersion(), sessionId);
    ret.set_data_size(is.getFileLength());
    blobDownloaders.put(sessionId, new BufferInputStream(is,
                               (int) conf
                                 .getOrDefault(Config.STORM_BLOBSTORE_INPUTSTREAM_BUFFER_SIZE_BYTES,
                                        65536)));
    LOG.info("Created download session {} for {}", sessionId, key);
    return ret;
  } catch (Exception e) {
    LOG.warn("begin blob download exception.", e);
    if (e instanceof TException) {
      throw (TException) e;
    }
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: apache/storm

topology.put_to_bolts(Utils.uuid(), new Bolt(Thrift.serializeComponentObject(capturer),
                       Thrift.prepareComponentCommon(captureBoltInputs, new HashMap<>(), null)));
return new CapturedTopology<>(topology, capturer);

代码示例来源:origin: apache/storm

String topoName = param.getTopologyName();
if (topoName == null) {
  topoName = "topologytest-" + Utils.uuid();

代码示例来源:origin: org.apache.storm/storm-core

public LocalContainer(Map<String, Object> conf, String supervisorId, int port, LocalAssignment assignment, IContext sharedContext) throws IOException {
  super(ContainerType.LAUNCH, conf, supervisorId, port, assignment, null, null, null);
  _sharedContext = sharedContext;
  _workerId = Utils.uuid();
}

相关文章

微信公众号

最新文章

更多

Utils类方法