private Runnable createProducer(final CloudNode cloudNode) {
        return () -> {
            logger.info("Producer thread started.");
            while (this.isMaster(cloudNode)) {
                try {
                    final Set<String> nodes = new HashSet<>(HazelcastHelper.this.getActiveNodes());
                    nodes.remove(cloudNode.getName());
                    if (nodes.size() > 0) {
                        final IAtomicLong serialNumber = getAtomicLong(TASK_NUMBER);
                        final String taskName = String.format("TASK-%d-%d", serialNumber.incrementAndGet(), System.currentTimeMillis());
                        HazelcastHelper.this.getTaskQueue().put(taskName);
                        logger.info("Added task {}", taskName);
                    }
                    Thread.sleep(RandomUtils.nextInt(1500, 4000));
                } catch (final Exception ex) {
                    logger.error("Exception occurred!", ex);
                }
            }
        };
    }