private static SourceState getSourceState(SourceState.SourceStatus status, MessageLevel level, String... msgs) { List<Message> messageList = new ArrayList<>(); for (String msg : msgs) { messageList.add(new Message(level, msg)); } return new SourceState(status, messageList); }
@Override public SourceState getState() { // Executors maintain no state about Hive; they do not communicate with the Hive meta store, so only tables can // have a bad state, and not the source. if (!isCoordinator) { return SourceState.GOOD; } try { processUserMetastoreClient.getDatabases(false); return SourceState.GOOD; } catch (Exception ex) { logger.debug("Caught exception while trying to get status of HIVE source, error: ", ex); return new SourceState(SourceStatus.bad, Collections.singletonList(new SourceState.Message(MessageLevel.ERROR, "Failure connecting to source: " + ex.getMessage()))); } }