I have a class which will get data from socket. I should create 5 instance of this class according several condition. How can i check if a specific instant of this class is running, other ways creating that specific instance which is missing?
This is Some code snip:

```
public void checkReachabilityOfHosts(){

    String[] host = {"192.168.30.190", "", "", "", "" };

    for (String h : host) {
        if (h.length() > 0) {
            if (isHostReachable(h)) {
                DeviceByteReader deviceByteReader = new DeviceByteReader(h, 3001);
                deviceByteReader.setUpConnection();
                deviceByteReader.getSMessage();
                deviceByteReader.tearDownConnection();
            } else {
                return;
            }
        }else {
            return;
        }
    }
}

```