![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java
zhsoft11
这个作者很懒,什么都没留下…
展开
-
线程中止
1.线程创建 start 2.线程终止 public static void main(String[] args) { Thread thread = new Thread(()->{ while(!Thread.currentThread().isInterrupted()){//默认false index++; Thread.interrupted();//复位 默认false;不让线程结束, } System.out.println(index); }); t原创 2020-10-25 19:41:27 · 65 阅读 · 0 评论 -
java BIO read阻塞
TCP流是无界限的,所以会有阻塞,等待发送结束标识-1 server public static void main(String[] args) throws IOException { ServerSocket server = new ServerSocket(8989); while(true){ //等待客户端连接,阻塞方法 //Socket数据发送者在服务端的引用 Socket client = server.accept();原创 2020-07-05 00:01:01 · 367 阅读 · 0 评论 -
Bean执行顺序
Bean(initMethod = “init”,destroyMethod =“destroy” )执行顺序 public class Dog { public Dog(){ System.out.println(“dog构造函数”); } public void init(){ System.out.println("dog init"); } public void destroy() { System.out.println("Dog的销毁方法执行了"); } } @Config原创 2020-06-18 02:57:46 · 508 阅读 · 1 评论