保存进度!

This commit is contained in:
unknown 2024-01-26 01:52:55 +08:00
parent 71aacc4c78
commit e0f6143942
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,42 @@
/*
* @Author: Kane
* @Date: 2024-01-26 01:20:00
* @LastEditors: Kane
* @FilePath: /MultiThread/src/main/java/com/cpic/xim/thread/SuspendResumeThread.java
* @Description:
*
* Copyright (c) ${2023} by Kane, All Rights Reserved.
*/
package com.cpic.xim.thread;
public class SuspendResumeThread implements Runnable
{
@Override
public void run()
{
try
{
System.out.println("进入工作线程!");
for (int i=0; i< 9999; i++ )
{
if ( Thread.currentThread().isInterrupted() )
{
throw new InterruptedException();
}
System.out.println( "工作线程计数:" + String.valueOf( i ) );
}
System.out.println("工作线程结束!");
}
catch ( InterruptedException error )
{
System.out.println("工作线程被中断!");
}
catch ( ThreadDeath error )
{
System.out.println("工作线程被stop");
}
}
}

View File

@ -14,7 +14,6 @@ public class MyThread extends Thread
@Override
public void run()
{
super.run();
System.out.println("我是工作线程:" + String.valueOf(Thread.currentThread().threadId()) );
}