Advertisement
sergAccount

Untitled

Mar 21st, 2021
848
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.06 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.app24;
  7.  
  8. /**
  9.  *
  10.  * @author Admin
  11.  */
  12. public class MyLongTask implements Runnable{
  13.     // поддержка принудительной остановки задачи
  14.     private boolean done;
  15.     private MyLongTaskResult result;
  16.     // входные параметры
  17.     private int value1;
  18.     private int value2;
  19.    
  20.     public MyLongTask(int value1, int value2){
  21.         this.value1 = value1;
  22.         this.value2 = value2;
  23.     }
  24.     @Override
  25.     public void run() {
  26.        
  27.         // use done for break
  28.         // ...
  29.         //result = new MyLongTaskResult();        
  30.     }    
  31.     //
  32.     public void done(String m){
  33.         System.out.println("MyLongTask.done invoked with message=" + m);
  34.         this.done = true;
  35.     }
  36.     // MyLongTaskResult
  37.     public MyLongTaskResult getResult(){
  38.         return result;
  39.     }
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement