Skip to content

Flying9001/javaThreadDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

javaThreademo

java 多线程使用示例

  • 1 创建多线程的3种方式(实现Runnable接口,继承Thread类,实现Callable接口)
    工作线程: com.ljq.thread.RunnableUtil,测试类: com.ljq.demo.RunnableDemo
    工作线程: com.ljq.thread.ThreadUtil,测试类: com.ljq.demo.ThreadDemo
    工作线程: com.ljq.thread.CallableCalculator, 测试类: com.ljq.demo.CallableCalculatorPoolDemo

  • 2 创建线程池的两种方式(实现Runnable接口,实现Callable接口)
    工作线程: com.ljq.thread.TaskRunnable , 测试类: com.ljq.demo.RunnablePoolDemo
    工作线程: com.ljq.thread.TaskCallable, 测试类: com.ljq.demo.FuturePoolDemo
    工作线程: com.ljq.thread.CallableCalculator, 测试类: com.ljq.demo.CallableCalculatorPoolDemo

  • 3 线程同步(synchronized)
    工作线程: com.ljq.task.SyncTask, 测试类: com.ljq.demo.ThreadsyncDemo

  • 4 线程之间通讯(Thread signaling)
    工作线程: com.ljq.task.PrintTask, 测试类: com.ljq.demo.ThreadSignalDemo

Releases

No releases published

Packages

 
 
 

Languages