private void handlerRepliSyncServerReceive(SocketChannel channel) {
        try {

            byte[] returnCode = StringUtils.fullSpace(Code.SERVER_RECEIVE_SHARED_AND_SEND_TO_REPLICATION.getCode()).getBytes();
            String version = ChannelUtils.readTop100(channel);
            byte[] returnVersion = StringUtils.fullSpace(version).getBytes();
            byte[] instruction = StringUtils.fullSpace(ChannelUtils.readTop100(channel)).getBytes();
            byte[] fileNameBytes = StringUtils.fullSpace(ChannelUtils.readTop100(channel)).getBytes();
            String length = ChannelUtils.readTop100(channel);
            byte[] fileContent = ChannelUtils.readFile(channel, Integer.parseInt(length));
            byte[] fileLength = StringUtils.fullSpace(fileContent.length).getBytes();
            byte[] array = new byte[returnCode.length + returnVersion.length + instruction.length + fileNameBytes.length + fileLength.length
                    + fileContent.length];

            ArrayUtils.arrayBytesCopy(returnCode, array, 0);
            ArrayUtils.arrayBytesCopy(returnVersion, array, returnCode.length);
            ArrayUtils.arrayBytesCopy(instruction, array, returnCode.length + returnVersion.length);
            ArrayUtils.arrayBytesCopy(fileNameBytes, array, returnCode.length + returnVersion.length + instruction.length);
            ArrayUtils.arrayBytesCopy(fileLength, array, returnCode.length + returnVersion.length + instruction.length + fileNameBytes.length);
            ArrayUtils.arrayBytesCopy(fileContent, array, returnCode.length + returnVersion.length + instruction.length + fileNameBytes.length
                    + fileLength.length);

            String alias = ChannelUtils.getUniqueAlias(channel);
            int index = 0;
            List<String> keys = new ArrayList<String>(sharedChannels.keySet());
            for (String key : keys) {
                if (key.equals(alias)) {
                    break;
                }
                index++;
            }

            if (sharedChannels.containsKey(alias)) {
                List<SocketChannel> replis = replicationChannels.get(alias);
                Map<String, String[]> map = FileUtils.readFileListLine(SERVER_FOLDER + index + Constants.REPLICATION_VERSION_POST, " ");
                for (SocketChannel repli : replis) {
                    String key = ChannelUtils.getUniqueAlias(repli);
                    if (map.containsKey(key)) {

                        // the replica is new
                        String[] arr = map.get(key);
                        if (!arr[2].equals(Constants.REPLICATION_RUNNING)) {

                            // This channel is not running.
                            continue;
                        }
                        if (arr[1].equals(Constants.NO_VERSION)) {
                            ChannelUtils.write(repli, array);
                        } else {

                            // judge the replica version
                            String currentVersion = arr[1].replace("V.", "");
                            long currentVersionLong = Long.parseLong(currentVersion);
                            long receiveVersionLong = Long.parseLong(version.replace("V.", ""));
                            if (currentVersionLong < receiveVersionLong) {
                                ChannelUtils.write(repli, array);
                            }
                        }

                    }
                }
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }