예제 #1
0
  @Override
  public void run() {
    // 判断有没有连接
    if (client.isConnected()) {
      // 已经建立连接
      TaskExecutor.getInstance().submitTask(new Online(client));
      Log.i("Mina", "------------>连接成功");
    } else {
      // 建立连接
      Log.d("Mina", "------------>建立连接");
      if (SystemConfig.loginResponse != null) {
        Log.d(
            "Mina",
            "------------>"
                + SystemConfig.loginResponse.getMinaIp()
                + ":"
                + SystemConfig.loginResponse.getMinaPort());
        client.connect(
            SystemConfig.loginResponse.getMinaIp(),
            Integer.parseInt(SystemConfig.loginResponse.getMinaPort()));
      } else {
        Log.e("Mina", "------------>无Mina地址和端口信息");
      }

      // 判断连接是否连接成功,上线
      if (client.isConnected()) {
        // 校验建立成功
        Log.i("Mina", "------------>已经连接成功");
        TaskExecutor.getInstance().submitTask(new Online(client));
      } else {
        Log.e("Mina", "------------>连接失败");
      }
    }
  }
예제 #2
0
 private void ensureExecutor() {
   if (mExecutor == null) {
     mExecutor = TaskExecutor.getInstance(mExecutorId);
   }
 }
예제 #3
0
 public void setExecutorId(int executorId) {
   this.mExecutorId = executorId;
   mExecutor = TaskExecutor.getInstance(mExecutorId);
 }