com.mpush.tools.Utils.newThread()方法的使用及代码示例

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

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

Utils.newThread介绍

暂无

代码示例

代码示例来源:origin: mpusher/mpush

public void fetchFormMQ() {
  Utils.newThread("mq-push", this::dispatch);
}

代码示例来源:origin: mpusher/mpush

@Override
protected void doStart(Listener listener) throws Throwable {
  if (printLog || dumpEnabled) {
    thread = Utils.newThread(ThreadNames.T_MONITOR, this);
    thread.setDaemon(true);
    thread.start();
  }
  listener.onSuccess();
}

代码示例来源:origin: mpusher/mpush

public static void dumpJmap(final String jvmPath) {
    Utils.newThread("dump-jmap-t", () -> jMap(jvmPath, false)).start();
  }
}

代码示例来源:origin: mpusher/mpush

public static void dumpJstack(final String jvmPath) {
  Utils.newThread("dump-jstack-t", (() -> {
    File path = new File(jvmPath);
    if (path.exists() || path.mkdirs()) {
      File file = new File(path, System.currentTimeMillis() + "-jstack.log");
      try (FileOutputStream out = new FileOutputStream(file)) {
        JVMUtil.jstack(out);
      } catch (Throwable t) {
        LOGGER.error("Dump JVM cache Error!", t);
      }
    }
  })).start();
}

代码示例来源:origin: mpusher/mpush

public void subscribe(final JedisPubSub pubsub, final String channel) {
  Utils.newThread(channel,
      () -> call(jedis -> {
        if (jedis instanceof MultiKeyCommands) {
          ((MultiKeyCommands) jedis).subscribe(pubsub, channel);
        } else if (jedis instanceof MultiKeyJedisClusterCommands) {
          ((MultiKeyJedisClusterCommands) jedis).subscribe(pubsub, channel);
        }
      })
  ).start();
}

代码示例来源:origin: mpusher/mpush

@Override
protected void doStart(Listener listener) throws Throwable {
  Utils.newThread("udp-client", () -> gatewayUDPConnector.start(listener)).start();
  ServiceDiscovery discovery = ServiceDiscoveryFactory.create();
  discovery.subscribe(GATEWAY_SERVER, this);
  discovery.lookup(GATEWAY_SERVER).forEach(this::addConnection);
}

代码示例来源:origin: com.github.mpusher/mpush-core

public void fetchFormMQ() {
  Utils.newThread("mq-push", this::dispatch);
}

代码示例来源:origin: com.github.mpusher/mpush-monitor

@Override
protected void doStart(Listener listener) throws Throwable {
  if (printLog || dumpEnabled) {
    thread = Utils.newThread(ThreadNames.T_MONITOR, this);
    thread.setDaemon(true);
    thread.start();
  }
  listener.onSuccess();
}

代码示例来源:origin: com.github.mpusher/mpush-tools

public static void dumpJstack(final String jvmPath) {
  Utils.newThread("dump-jstack-t", (() -> {
    File path = new File(jvmPath);
    if (path.exists() || path.mkdirs()) {
      File file = new File(path, System.currentTimeMillis() + "-jstack.log");
      try (FileOutputStream out = new FileOutputStream(file)) {
        JVMUtil.jstack(out);
      } catch (Throwable t) {
        LOGGER.error("Dump JVM cache Error!", t);
      }
    }
  })).start();
}

代码示例来源:origin: com.github.mpusher/mpush-tools

public static void dumpJmap(final String jvmPath) {
    Utils.newThread("dump-jmap-t", () -> jMap(jvmPath, false)).start();
  }
}

代码示例来源:origin: com.github.mpusher/mpush-cache

public void subscribe(final JedisPubSub pubsub, final String channel) {
  Utils.newThread(channel,
      () -> call(jedis -> {
        if (jedis instanceof MultiKeyCommands) {
          ((MultiKeyCommands) jedis).subscribe(pubsub, channel);
        } else if (jedis instanceof MultiKeyJedisClusterCommands) {
          ((MultiKeyJedisClusterCommands) jedis).subscribe(pubsub, channel);
        }
      })
  ).start();
}

代码示例来源:origin: com.github.mpusher/mpush-client

@Override
protected void doStart(Listener listener) throws Throwable {
  Utils.newThread("udp-client", () -> gatewayUDPConnector.start(listener)).start();
  ServiceDiscovery discovery = ServiceDiscoveryFactory.create();
  discovery.subscribe(GATEWAY_SERVER, this);
  discovery.lookup(GATEWAY_SERVER).forEach(this::addConnection);
}

相关文章