Opens - and on failures reopens - its own database connection, because polling for notifications blocks the connection it runs on. Reconnecting is retried for as long as the library is open: every successful reconnect is followed by a full pull, so an outage costs nothing but delay.
| Modifier and Type | Field and Description |
|---|---|
| private volatile @Nullable Connection | |
| private final DatabaseConnection | |
| private final DBMSSynchronizer | |
| private final Gson | |
| private static final Logger | |
| private static final long | |
| private volatile @Nullable PGConnection | |
| private final String | |
| private volatile boolean |
| Access | Constructor and Description |
|---|---|
| public | NotificationListener(DBMSSynchronizer dbmsSynchronizer, DatabaseConnection dbmsConnection, String processorId)
|
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private PGConnection | |
| private void | |
| public void | |
| public void | |
| public void |
| connection | back to summary |
|---|---|
| private volatile @Nullable Connection connection | |
| dbmsConnection | back to summary |
|---|---|
| private final DatabaseConnection dbmsConnection | |
| dbmsSynchronizer | back to summary |
|---|---|
| private final DBMSSynchronizer dbmsSynchronizer | |
| gson | back to summary |
|---|---|
| private final Gson gson | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| MAX_RECONNECT_DELAY_MILLIS | back to summary |
|---|---|
| private static final long MAX_RECONNECT_DELAY_MILLIS | |
| pgConnection | back to summary |
|---|---|
| private volatile @Nullable PGConnection pgConnection | |
| processorId | back to summary |
|---|---|
| private final String processorId | |
| stop | back to summary |
|---|---|
| private volatile boolean stop | |
| NotificationListener | back to summary |
|---|---|
| public NotificationListener(DBMSSynchronizer dbmsSynchronizer, DatabaseConnection dbmsConnection, String processorId) | |
| closeConnection | back to summary |
|---|---|
| private void closeConnection() | |
| connect | back to summary |
|---|---|
| private PGConnection connect() throws SQLException | |
| handleNotification | back to summary |
|---|---|
| private void handleNotification(PGNotification notification) | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |
| start | back to summary |
|---|---|
| public void start() throws SQLException Registers the notification subscription. Called before the polling starts, so that no notification sent right after this method returns can be missed. | |
| stop | back to summary |
|---|---|
| public void stop() | |