/** * Returns the correct instance of {@link FileArchiverNotifier} for the given table name. * * @param tn The table name * @return A {@link FileArchiverNotifier} instance */ FileArchiverNotifier getNotifierForTable(TableName tn) { return FileArchiverNotifierFactoryImpl.getInstance().get(conn, conf, fs, tn); }
public void processFileArchivals(FileArchiveNotificationRequest request, Connection conn, Configuration conf, FileSystem fs) throws IOException { final HashMultimap<TableName,Entry<String,Long>> archivedFilesByTable = HashMultimap.create(); // Group the archived files by table for (FileWithSize fileWithSize : request.getArchivedFilesList()) { TableName tn = ProtobufUtil.toTableName(fileWithSize.getTableName()); archivedFilesByTable.put( tn, Maps.immutableEntry(fileWithSize.getName(), fileWithSize.getSize())); } if (LOG.isTraceEnabled()) { LOG.trace("Grouped archived files by table: " + archivedFilesByTable); } // Report each set of files to the appropriate object for (TableName tn : archivedFilesByTable.keySet()) { final Set<Entry<String,Long>> filesWithSize = archivedFilesByTable.get(tn); final FileArchiverNotifier notifier = FileArchiverNotifierFactoryImpl.getInstance().get( conn, conf, fs, tn); notifier.addArchivedFiles(filesWithSize); } } }