public void run() { while (isAlive) { update(); Dysco dysco = dyscosQueue.poll(); if (dysco == null) { try { synchronized (this) { this.wait(100); } } catch (InterruptedException e) { logger.error(e.getMessage()); } continue; } else { try { searchForDysco(dysco); } catch (Exception e) { logger.error( "Error during searching for dysco: " + dysco.getId() + " of type: " + dysco.getDyscoType()); logger.error("Exception: " + e.getMessage()); } } } }
public void addDysco(Dysco dysco) { try { dyscosQueue.put(dysco); logger.info(dysco.getId() + " putted in dyscos queue (" + dyscosQueue.size() + ")"); } catch (Exception e) { logger.error(e); } }