zoukankan      html  css  js  c++  java
  • java 多线程

    @Log4j
    public class SendSms extends Thread {
    public SendSms() {
    }

    public void run() {
    try {
    Config config = new Config();
    String host = config.get("smgwip");
    String account = config.get("smgwaccount");
    String passwd = config.get("smgwpasswd");
    String spid = config.get("smgwspid");
    String spnum = config.get("smgpspnum");
    int port = Integer.parseInt(config.get("smgwport"));
    String destnum = config.get("destnum");
    String content = config.get("content");
    String productid = config.get("productid");
    Client client = new Client(host, port, 2, account, passwd, spid, 0);
    Submit submit = new Submit();
    submit.setSrcTermid(spnum);
    submit.setDestTermid(destnum);
    submit.setMsgContent(content.getBytes("iso-10646-ucs-2"));
    submit.setMsgFormat(8);
    if (productid != null) {
    submit.setProductID(productid);
    }

    Result result = client.Send(submit);
    log.info("Status:" + result.ErrorCode);
    log.info("MsgID:" + result.ErrorDescription);
    client.Close();
    } catch (Exception ex) {
    log.error("Error: " + ex.getMessage());
    }
    }

    public static void main(String[] args) throws IOException {
    for (int total = 0; total < 60; ) {
    for (int count = 0; count < 2; count++) {
    try {
    SendSms sendSms = new SendSms();
    sendSms.start();
    total++;
    Thread.sleep(1000);
    } catch (InterruptedException ex) {
    log.error("Ignore Error: " + ex.getMessage());
    }
    }
    }
    }
    }
  • 相关阅读:
    linux commands ---2 ,学习vim编辑器如何使用的方法。
    $stateParams 详解
    ipa 打包遇到的坑
    原生和jQuery的ajax用法
    ios 的 desciption
    ios上线流程
    android 上线流程
    cordova 常用插件
    iframe
    cordova 强制竖屏
  • 原文地址:https://www.cnblogs.com/dinglulu/p/5235509.html
Copyright © 2011-2022 走看看