@Override public Integer getValue() { return getSessions().size(); } };
@Override public Integer getValue() { Iterable<HiveSession> filtered = Iterables.filter(getSessions(), new Predicate<HiveSession>() { @Override public boolean apply(HiveSession hiveSession) { return hiveSession.getNoOperationTime() == 0L; } }); return Iterables.size(filtered); } };
@Override public Integer getValue() { long sum = 0; long currentTime = System.currentTimeMillis(); for (HiveSession s : getSessions()) { sum += currentTime - s.getCreationTime(); } // in case of an overflow return -1 return (int) sum != sum ? -1 : (int) sum; } };
@Override public Integer getValue() { long sum = 0; long currentTime = System.currentTimeMillis(); for (HiveSession s : getSessions()) { if (s.getNoOperationTime() == 0L) { sum += currentTime - s.getLastAccessTime(); } } // in case of an overflow return -1 return (int) sum != sum ? -1 : (int) sum; } };
private void closeAndDisallowHiveSessions() { LOG.info("Closing all open hive sessions."); if (cliService == null) return; cliService.getSessionManager().allowSessions(false); // No sessions can be opened after the above call. Close the existing ones if any. try { for (HiveSession session : cliService.getSessionManager().getSessions()) { cliService.getSessionManager().closeSession(session.getSessionHandle()); } LOG.info("Closed all open hive sessions"); } catch (HiveSQLException e) { LOG.error("Unable to close all open sessions.", e); } }
Collection<HiveSession> hiveSessions = sessionManager.getSessions(); int sessionCount = 0; for (HiveSession hiveSession: hiveSessions) {
@Override public Integer getValue() { return getSessions().size(); } };
@Override public Integer getValue() { Iterable<HiveSession> filtered = Iterables.filter(getSessions(), new Predicate<HiveSession>() { @Override public boolean apply(HiveSession hiveSession) { return hiveSession.getNoOperationTime() == 0L; } }); return Iterables.size(filtered); } };
@Override public Integer getValue() { long sum = 0; long currentTime = System.currentTimeMillis(); for (HiveSession s : getSessions()) { sum += currentTime - s.getCreationTime(); } // in case of an overflow return -1 return (int) sum != sum ? -1 : (int) sum; } };
@Override public Integer getValue() { long sum = 0; long currentTime = System.currentTimeMillis(); for (HiveSession s : getSessions()) { if (s.getNoOperationTime() == 0L) { sum += currentTime - s.getLastAccessTime(); } } // in case of an overflow return -1 return (int) sum != sum ? -1 : (int) sum; } };
private void closeHiveSessions() { LOG.info("Closing all open hive sessions."); if (cliService != null && cliService.getSessionManager().getOpenSessionCount() > 0) { try { for (HiveSession session : cliService.getSessionManager().getSessions()) { cliService.getSessionManager().closeSession(session.getSessionHandle()); } LOG.info("Closed all open hive sessions"); } catch (HiveSQLException e) { LOG.error("Unable to close all open sessions.", e); } } }
Collection<HiveSession> hiveSessions = sessionManager.getSessions(); int sessionCount = 0; for (HiveSession hiveSession: hiveSessions) {