public boolean updateLeader(final String groupId, final PeerId leader) {
        Requires.requireTrue(!StringUtils.isBlank(groupId), "Blank group id");

        if (leader != null) {
            // If leader presents, it should not be empty.
            Requires.requireTrue(!leader.isEmpty(), "Empty leader");
        }

        final GroupConf gc = getOrCreateGroupConf(groupId);
        final StampedLock stampedLock = gc.stampedLock;
        final long stamp = stampedLock.writeLock();
        try {
            gc.leader = leader;
        } finally {
            stampedLock.unlockWrite(stamp);
        }
        return true;
    }
Update leader info.

@param groupId raft group id
@param leader  peer of leader
@return true on success
jraft-core/src/main/java/com/alipay/sofa/jraft/RouteTable.java