Verified Owner
Top Description Fields Constructors Methods
org.jabref.logic.shared.notifications

public Class Notifier

extends Object
Class Inheritance
Annotations
@NullMarked
Imports
java.nio.charset.StandardCharsets, java.sql.Connection, .PreparedStatement, .SQLException, java.util.Optional, org.jabref.model.entry.BibEntry, org.jabref.model.entry.event.FieldChangedEvent, com.google.gson.Gson, .GsonBuilder, org.jspecify.annotations.NullMarked, org.slf4j.Logger, .LoggerFactory

Notifies the other clients connected to the same database about changes.

Field Summary

Modifier and TypeField and Description
public static final String
CHANNEL

Used as string argument to pg_notify, which - unlike the LISTEN command - does not case-fold its channel argument.

private final Connection
private final Gson
private static final Logger
private static final int
public static final String
METADATA_CHANNEL

Channel on which the database-side upsert_metadata function announces changed metadata values

private final String

Constructor Summary

AccessConstructor and Description
public
Notifier(Connection connection, String processorId)

Method Summary

Modifier and TypeMethod and Description
private FieldChange
public void
public void
notifyClientsToPull()

Asks all other clients to pull.

private void
send(FieldChange payload)

private FieldChange
withoutContent()

A payload without content makes receivers pull the changes from the database instead

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CHANNELback to summary
public static final String CHANNEL

Used as string argument to pg_notify, which - unlike the LISTEN command - does not case-fold its channel argument. Both sides therefore use this constant verbatim (the listener quotes it in LISTEN).

connectionback to summary
private final Connection connection
gsonback to summary
private final Gson gson
LOGGERback to summary
private static final Logger LOGGER
MAX_PAYLOAD_BYTESback to summary
private static final int MAX_PAYLOAD_BYTES
METADATA_CHANNELback to summary
public static final String METADATA_CHANNEL

Channel on which the database-side upsert_metadata function announces changed metadata values

processorIdback to summary
private final String processorId

Constructor Detail

Notifierback to summary
public Notifier(Connection connection, String processorId)

Method Detail

createPayloadback to summary
private FieldChange createPayload(FieldChangedEvent event)
notifyAboutChangedFieldback to summary
public void notifyAboutChangedField(FieldChangedEvent event)
notifyClientsToPullback to summary
public void notifyClientsToPull()

Asks all other clients to pull. Used when changes reached the database without a single field-change event describing them - e.g. flushed micro-edits, which are written as a whole entry.

sendback to summary
private void send(FieldChange payload)
withoutContentback to summary
private FieldChange withoutContent()

A payload without content makes receivers pull the changes from the database instead