@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 AutoCloseable
SQLException
public 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
SQLException
InterruptedException
public 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
SQLException
InterruptedException
public long getLastRunDB() throws SQLException, InterruptedException
SQLException
InterruptedException
public 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.InterruptedException
SQLException
public static JdbcHeartBeat getHeartBeatAndSubscribe(DataSource dataSource, HeartBeatTableDesc hbTableDesc, @Nullable JdbcHeartBeat.LifecycleHook hook, int heartBeatIntevalMillis, int jdbcTimeoutSeconds) throws InterruptedException, SQLException
InterruptedException
SQLException
public 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
InterruptedException
SQLException
public static void stopHeartBeats()
public HeartBeatTableDesc getHbTableDesc()
Copyright © 2018 SPF4J. All rights reserved.