public void registerMessageHandlers(MessageDispatchRegistry messageDispatcher) {
		messageDispatcher.set(RefreshCacheMessage.class,
			new AbstractHandler<RefreshCacheMessage>() {
				@Override
				public void handle(RefreshCacheMessage message) {
					m_logger.info("Refresh cached file store");
					Set<String> requiredFilesDigest = message.getDisFilesDigest();
					File cacheDir = m_incomingDirectory.getFile();

					try {
						List<File> cachedFiles = getAllFilesInDirectory(cacheDir);
						cachedFiles
							.stream()
							.filter(file ->  !requiredFilesDigest.contains(getFileDigest(cacheDir, file)))
							.forEach(FileUtils::deleteQuietly);
					} catch (IOException e) {
						m_logger.info("Failed refresh cached file store", e);
					}
				}
			});

		messageDispatcher.set(
			ClearCacheMessage.class,
			new AbstractHandler<ClearCacheMessage>() {
				public void handle(ClearCacheMessage message)
					throws CommunicationException {

					m_logger.info("Clearing file store");

					try {
						synchronized (m_incomingDirectory) {
							m_incomingDirectory.deleteContents();
							m_incremental = false;
						}
					}
					catch (Directory.DirectoryException e) {
						m_logger.error(e.getMessage());
						throw new CommunicationException(e.getMessage(), e);
					}
				}
			});

		messageDispatcher.set(
			DistributeFileMessage.class,
			new AbstractHandler<DistributeFileMessage>() {
				public void handle(DistributeFileMessage message)
					throws CommunicationException {
					try {
						synchronized (m_incomingDirectory) {
							m_incomingDirectory.create();

							createReadmeFile();

							final FileContents fileContents = message.getFileContents();

							m_logger.info("Updating file store: {}", fileContents);
							fileContents.create(m_incomingDirectory);
						}
					}
					catch (FileContents.FileContentsException | Directory.DirectoryException e) {
						m_logger.error(e.getMessage());
						throw new CommunicationException(e.getMessage(), e);
					}
				}
			});

		messageDispatcher.set(
			DistributionCacheCheckpointMessage.class,
			new AbstractHandler<DistributionCacheCheckpointMessage>() {
				public void handle(DistributionCacheCheckpointMessage message) {
					m_cacheHighWaterMark = message.getCacheHighWaterMark();
				}
			});
	}
Registers message handlers with a dispatcher.

@param messageDispatcher The dispatcher.
ngrinder-core/src/main/java/net/grinder/engine/agent/FileStore.java