Advertisement
sergAccount

Untitled

Mar 14th, 2021
710
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package com.mycompany.app21;
  7.  
  8. public class MyTask implements Runnable{
  9.  
  10.     @Override
  11.     public void run() {
  12.         // ...
  13.         long curTime = System.currentTimeMillis();
  14.         try{
  15.             System.out.println("MyTask.run>>");
  16.             //
  17.             Thread curTh = Thread.currentThread();
  18.             System.out.println("MyTask.curTh=" + curTh.getName());
  19.        
  20.        
  21.             System.out.println("MyTask<<");
  22.         }finally{
  23.             long total = System.currentTimeMillis() - curTime;
  24.             System.out.println("MyTask.total=" + total);
  25.         }
  26.     }
  27.    
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement