码迷,mamicode.com
首页 >  
搜索关键字:Thread    ( 13581个结果)
线程如何正确的启动
在前面我们已经了解到如何创建线程,要么就重写Thread类的run方法,要么就实现Runnable接口的run方法,然后调用Thread类的start方法去启动它,可能我们发现了,最终执行的其实还是run方法里面的代码,那么为什么一定要通过start方法来调用呢?我直接调用run方法不就好了吗,正常... ...
分类:编程语言   时间:2020-04-14 20:25:54    阅读次数:73
线程间通信
测试多个线程发送数据 public class Test { public Test(){ // 开启接收线程 new Thread(new SendRunnable()).start(); } /** * 模拟多线程并发,发送消息 */ public void beginTest(){ new T ...
分类:编程语言   时间:2020-04-14 17:01:27    阅读次数:62
文件MD5 并复制到剪切板
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Li ...
分类:其他好文   时间:2020-04-14 16:55:07    阅读次数:66
Zuul —— SpringCloud(七)
什么是Zuul? Zuul是Netflix开源的微服务网关。 Zuul可以和Eureka、Ribbon、Hystrix等组件配合使用。 Zuul的核心是一系列的过滤器,可以完成以下功能。 身份认证和安全:识别每个资源的验证请求,并拒绝那些与要求不符的请求。 审查与监控:在边缘位置追踪有意义的数据和统 ...
分类:编程语言   时间:2020-04-14 16:42:35    阅读次数:69
python 多线程 thread (控制主线程跑完,子线程也关闭)
import threadfrom time import sleep, ctime loops = [4,2]def loop0(): print 'start loop 0 at:', ctime() sleep(4) print 'loop 0 done at:', ctime() def l ...
分类:编程语言   时间:2020-04-14 16:37:04    阅读次数:128
Thread的Interrupt、isInterrupted、interrupted
线程中断:Interrupt、isInterrupted、interrupted 线程并不是抢占式的,线程是协作式的。 Interrupt:声明此线程中断,但是线程并不会立即中断; isInterrupted:判断此线程是否已中断,判断完后不修改线程的中断状态; interrupted:判断此线程是 ...
分类:其他好文   时间:2020-04-14 00:59:37    阅读次数:81
CountDownLatch的使用案例
public class CountDownLatch { public static void main(String[] args) throws Exception{ java.util.concurrent.CountDownLatch countDownLatch = new java.u ...
分类:其他好文   时间:2020-04-13 23:08:55    阅读次数:76
UDP实现多线程聊天
1 from socket import * 2 from threading import Thread 3 udp_socket = socket(AF_INET,SOCK_DGRAM) 4 #绑定端口 5 udp_socket.bind(('',8989)) 6 7 #不停接收 8 def r ...
分类:编程语言   时间:2020-04-13 22:34:00    阅读次数:74
生产者-消费者
1 import time 2 from threading import Thread 3 from queue import Queue 4 class Producter(Thread): 5 def run(self): 6 global queue 7 count = 0 8 while ...
分类:其他好文   时间:2020-04-13 19:30:05    阅读次数:57
SpringFeign 的 Hystrix 熔断器出现 timed-out and no fallback available 错误
Hystrix 熔断器默认超时时间是 1 秒钟,我们需要在配置中修改它的超时时间配置,同时也要设置 ribbon 的超时时间。 解决方法:application中配置以下 hystrix: command: default: execution: isolation: thread: timeout ...
分类:编程语言   时间:2020-04-13 12:39:01    阅读次数:207
共13581条   上一页 1 ... 75 76 77 78 79 ... 1359 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!