@ParametersAreNonnullByDefault @ThreadSafe public final class JdbcHeartBeat extends Object implements AutoCloseable
| Modifier and Type | Class and Description |
|---|---|
static interface |
JdbcHeartBeat.LifecycleHook |
public void close()
throws SQLException
close in interface AutoCloseableSQLExceptionpublic long getBeatDurationNanos()
public void registerJmx()
public void unregisterJmx()
public void addLyfecycleHook(JdbcHeartBeat.LifecycleHook hook)
public void removeLifecycleHook(JdbcHeartBeat.LifecycleHook hook)
public int removeDeadHeartBeatRows(long timeoutSeconds)
throws SQLException,
InterruptedException
SQLExceptionInterruptedExceptionpublic void removeDeadHeartBeatRowsAsyncNoReturn(long timeoutSeconds)
public Future<Integer> removeDeadHeartBeatRowsAsync(long timeoutSeconds)
public void scheduleHeartbeat(com.google.common.util.concurrent.ListeningScheduledExecutorService scheduler)
public void beat()
throws SQLException,
InterruptedException
SQLExceptionInterruptedExceptionpublic long getLastRunDB()
throws SQLException,
InterruptedException
SQLExceptionInterruptedExceptionpublic long getIntervalMillis()
public long getLastRunNanos()
public String getLastRunTimeStampString()
public static JdbcHeartBeat getHeartBeatAndSubscribe(DataSource dataSource, HeartBeatTableDesc hbTableDesc, @Nullable JdbcHeartBeat.LifecycleHook hook) throws InterruptedException, SQLException
dataSource - the datasource the hearbeat goes against.hbTableDesc - - heartbeat table description.hook - a hook to notify when heartbeat fails.InterruptedExceptionSQLExceptionpublic static JdbcHeartBeat getHeartBeatAndSubscribe(DataSource dataSource, HeartBeatTableDesc hbTableDesc, @Nullable JdbcHeartBeat.LifecycleHook hook, int heartBeatIntevalMillis, int jdbcTimeoutSeconds) throws InterruptedException, SQLException
InterruptedExceptionSQLExceptionpublic static JdbcHeartBeat getHeartBeatAndSubscribe(DataSource dataSource, HeartBeatTableDesc hbTableDesc, @Nullable JdbcHeartBeat.LifecycleHook hook, int heartBeatIntevalMillis, int jdbcTimeoutSeconds, com.google.common.util.concurrent.ListeningScheduledExecutorService scheduler) throws InterruptedException, SQLException
InterruptedExceptionSQLExceptionpublic static void stopHeartBeats()
public HeartBeatTableDesc getHbTableDesc()
Copyright © 2018 SPF4J. All rights reserved.