Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Check_services implements Runnable{
- List<Service> services;
- boolean running=true;
- public Check_services(List services)
- {
- this.services = services;
- }
- @Override
- public void run()
- {
- while(running)
- {
- for(Service s : services)
- {
- if(!s.portIsOpen())
- {
- // fire Telegram Message
- }
- }
- try
- {
- Thread.sleep(10000);
- }
- catch (InterruptedException ex)
- {
- System.out.println("Error speep @ Check_services.class");
- ex.printStackTrace();
- }
- }
- }
- public void startCheck()
- {
- checking = new Thread(new Check_services(services));
- checking.start();
- }
- public void stopCheck() throws InterruptedException
- {
- if (!checking.isInterrupted())
- {
- checking.interrupt();
- checking.join();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement