public synchronized boolean setMaster(final CloudNode cloudNode) {
        Objects.requireNonNull(cloudNode, "The given cloud node must not be null.");

        final Lock lock = Holder.INSTANCE.getInstance().getLock("my-distributed-lock");
        lock.lock();

        try {
            final NodeRecord masterRecord = HazelcastHelper.<NodeRecord>getAtomicReference(MASTER_NODE).get();

            if (masterRecord != null) {
                final long count = Holder.INSTANCE.getInstance().getCluster().getMembers()
                        .stream()
                        .filter(member -> StringUtils.equals(masterRecord.getMemberId(), member.getUuid()))
                        .count();

                if (count != 0) {
                    logger.warn("The master node has already existed: {}", masterRecord);
                    return false;
                }

                this.unregisterNode(masterRecord.getNodeName());
            }

            final NodeRecord newMasterRecord = HazelcastHelper.<String, NodeRecord>getMap(ACTIVE_NODES).get(cloudNode.getName());
            HazelcastHelper.getAtomicReference(MASTER_NODE).set(newMasterRecord);
            logger.info("This node has already become the new master node: {}", newMasterRecord);

            if (WORKING_MODE) {
                final Thread thread = new Thread(this.createProducer(cloudNode));
                thread.start();
            }
        } finally {
            lock.unlock();
        }

        return true;
    }