小编kde*_*den的帖子

Kubuntu 16.04上的MySQl 5.7安装失败

Configuring mysql-server-5.7 (5.7.11-0ubuntu6) … 
insserv: warning: current start runlevel(s) (empty) of script `mysql' overrides LSB defaults (2 3 4 5). 
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `mysql' overrides LSB defaults (0 1 6).
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) while connecting to the MySQL server 
Upgrade process encountered error and will not continue. 
mysql_upgrade failed with exit status 11 
dpkg: error with
   mysql-server-5.7 (--configure): …
Run Code Online (Sandbox Code Playgroud)

mysql linux ubuntu

5
推荐指数
2
解决办法
4767
查看次数

没有Thread.sleep(...)调用,线程代码无法正常工作

我有以下代码:

public class ThreadTest implements Runnable {
    public int ThrCount    = 0;

    public void ThrCountIncr() {
        while (true) {
            ThrCount++;
            System.out.println(ThrCount);
            try {
                Thread.currentThread().sleep(500);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }

    public void run() {
        while (true) {
            if (ThrCount > 10) {
                System.out.println(ThrCount + "\n Thread finished");
                System.exit(1);
            }
            try {
                Thread.currentThread().sleep(100);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

但是,当我从中删除此行时run,它将停止工作:

Thread.currentThread().sleep(100);
Run Code Online (Sandbox Code Playgroud)

首先,我启动线程,然后我使用 …

java multithreading

2
推荐指数
1
解决办法
275
查看次数

标签 统计

java ×1

linux ×1

multithreading ×1

mysql ×1

ubuntu ×1