All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nyla.solutions.global.patterns.workthread.StartState Maven / Gradle / Ivy

Go to download

Nyla Solutions Global Java API provides support for basic application utilities (application configuration, data encryption, debugger and text processing).

The newest version!
package nyla.solutions.global.patterns.workthread;

import nyla.solutions.global.util.Debugger;

/**
 * 
 * 
 * StartState starts a worker's thread if it is not alive
 * 
* @author Gregory Green * @version 1.0 */ public class StartState implements WorkState { /** * * @see java.lang.Runnable#run() */ public void advise(SupervisedWorker worker) { if(worker == null) return; Debugger.println(this, "Advising the worker "+worker.getName()); Thread workerThread = worker.getThread(); if(!workerThread.isAlive()) { workerThread.start(); } }// -------------------------------------------- /** * @return the name */ public String getName() { return name; }// -------------------------------------------- /** * * @see java.lang.Object#toString() */ public String toString() { return name; }// -------------------------------------------- private String name = this.getClass().getName(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy