class WorkerRegistryV2 implements WorkerRegistry, WorkerEventSubscriber {

    @Override
    public boolean isWorkerValid(WorkerId workerId) {
        if(logger.isDebugEnabled()) {  logger.debug("In isWorkerValid event {}", workerId); }
        Optional<JobId> jIdOp = JobId.fromId(workerId.getJobId());
        if(!jIdOp.isPresent()) {
            logger.warn("Invalid job Id {}", workerId.getJobId());
            return false;
        }
        List<IMantisWorkerMetadata> mantisWorkerMetadataList = jobToWorkerInfoMap.get(jIdOp.get());
      //  logger.info("Current Map {}", jobToWorkerInfoMap);
        boolean isValid = false;
        if(mantisWorkerMetadataList != null) {

            isValid = mantisWorkerMetadataList.stream().anyMatch((mData) -> mData.getWorkerId().equals(workerId));
        } else {
            logger.warn("No such job {} found in job To worker map ", jIdOp.get());
        }
        return isValid;
    }

      WorkerRegistryV2();

}