public interface EventManager extends AttachmentProperties, java.lang.AutoCloseable
EventListener
instances to listen for database events.Modifier and Type | Method and Description |
---|---|
void |
addEventListener(java.lang.String eventName,
EventListener listener)
Register an EventListener that will be called when an event occurs.
|
void |
close()
If connected, disconnects, otherwise does nothing.
|
void |
connect()
Make a connection with a database to listen for events.
|
void |
disconnect()
Close the connection to the database.
|
java.lang.String |
getDatabase()
Deprecated.
Use
getDatabaseName() ; will be removed in Jaybird 6 or later |
java.lang.String |
getDatabaseName()
Get the database name.
|
java.lang.String |
getHost()
Deprecated.
Use
AttachmentProperties.getServerName() ; will be removed in Jaybird 6 or later |
int |
getPort()
Deprecated.
Use
AttachmentProperties.getPortNumber() ; will be removed in Jaybird 6 or later |
long |
getWaitTimeout()
Get the poll timeout in milliseconds of the async thread to check whether it was stopped or not.
|
WireCrypt |
getWireCryptAsEnum()
Get the wire encryption level.
|
boolean |
isConnected() |
void |
removeEventListener(java.lang.String eventName,
EventListener listener)
Remove an EventListener for a given event.
|
void |
setDatabase(java.lang.String database)
Deprecated.
Use
setDatabaseName(String) ; will be removed in Jaybird 6 or later |
void |
setDatabaseName(java.lang.String databaseName)
Set the database name.
|
void |
setHost(java.lang.String host)
Deprecated.
Use
AttachmentProperties.setServerName(String) ; will be removed in Jaybird 6 or later |
void |
setPort(int port)
Deprecated.
Use
AttachmentProperties.setPortNumber(int) ; will be removed in Jaybird 6 or later |
void |
setWaitTimeout(long waitTimeout)
Set the poll timeout in milliseconds of the async thread to check whether it was stopped or not.
|
void |
setWireCryptAsEnum(WireCrypt wireCrypt)
Set the wire encryption level.
|
int |
waitForEvent(java.lang.String eventName)
Wait for the one-time occurrence of an event.
|
int |
waitForEvent(java.lang.String eventName,
int timeout)
Wait for the one-time occurrence of an event.
|
getAuthPlugins, getCharSet, getConnectTimeout, getDbCryptConfig, getEncoding, getParallelWorkers, getPassword, getPortNumber, getProcessId, getProcessName, getRoleName, getServerName, getSocketBufferSize, getSoTimeout, getType, getUser, getWireCrypt, isWireCompression, setAuthPlugins, setCharSet, setConnectTimeout, setDbCryptConfig, setEncoding, setParallelWorkers, setPassword, setPortNumber, setProcessId, setProcessName, setRoleName, setServerName, setSocketBufferSize, setSoTimeout, setType, setUser, setWireCompression, setWireCrypt
connectionPropertyValues, getBooleanProperty, getBooleanProperty, getIntProperty, getIntProperty, getProperty, getProperty, setBooleanProperty, setIntProperty, setProperty
void connect() throws java.sql.SQLException
java.sql.SQLException
- If a database communication error occursjava.lang.IllegalStateException
- If already connectedvoid close() throws java.sql.SQLException
Contrary to disconnect()
, this method does not throw IllegalStateException
when not connected.
close
in interface java.lang.AutoCloseable
java.sql.SQLException
- For errors during disconnectvoid disconnect() throws java.sql.SQLException
java.sql.SQLException
- If a database communication error occursjava.lang.IllegalStateException
- If not currently connectedclose()
boolean isConnected()
true
when connected and able to listen for eventsconnect()
,
disconnect()
java.lang.String getDatabaseName()
See DatabaseConnectionProperties.getDatabaseName()
for details.
void setDatabaseName(java.lang.String databaseName)
See DatabaseConnectionProperties.setDatabaseName(String)
for details.
databaseName
- database name@Deprecated void setDatabase(java.lang.String database)
setDatabaseName(String)
; will be removed in Jaybird 6 or laterdatabase
- path or url for the connection to the database.@Deprecated java.lang.String getDatabase()
getDatabaseName()
; will be removed in Jaybird 6 or later@Deprecated java.lang.String getHost()
AttachmentProperties.getServerName()
; will be removed in Jaybird 6 or later@Deprecated void setHost(java.lang.String host)
AttachmentProperties.setServerName(String)
; will be removed in Jaybird 6 or later
See AttachmentProperties.setServerName(String)
for details.
host
- for the connection to the database.@Deprecated int getPort()
AttachmentProperties.getPortNumber()
; will be removed in Jaybird 6 or later@Deprecated void setPort(int port)
AttachmentProperties.setPortNumber(int)
; will be removed in Jaybird 6 or laterport
- for the connection to the database.WireCrypt getWireCryptAsEnum()
void setWireCryptAsEnum(WireCrypt wireCrypt)
wireCrypt
- Wire encryption level (null
not allowed)long getWaitTimeout()
Default value is 1000 (1 second).
void setWaitTimeout(long waitTimeout)
Default value is 1000 (1 second).
waitTimeout
- wait timeout in millisecondsvoid addEventListener(java.lang.String eventName, EventListener listener) throws java.sql.SQLException
eventName
- The name of the event for which the listener will be notifiedlistener
- The EventListener that will be called when the given event occursjava.sql.SQLException
- If a database access error occursvoid removeEventListener(java.lang.String eventName, EventListener listener) throws java.sql.SQLException
eventName
- The name of the event for which the listener will be unregistered.listener
- The EventListener that is to be unregisteredjava.sql.SQLException
- If a database access error occursint waitForEvent(java.lang.String eventName) throws java.lang.InterruptedException, java.sql.SQLException
This method blocks indefinitely until the event identified by the value of eventName
occurs. The return
value is the number of occurrences of the requested event.
eventName
- The name of the event to wait forjava.lang.InterruptedException
- If interrupted while waitingjava.sql.SQLException
- If a database access error occursint waitForEvent(java.lang.String eventName, int timeout) throws java.lang.InterruptedException, java.sql.SQLException
This method blocks for a maximum of timeout
milliseconds, waiting for the event identified by
eventName
to occur. A timeout value of 0
means wait indefinitely.
The return value is the number of occurences of the event in question, or -1
if the call timed out.
eventName
- The name of the event to wait fortimeout
- The maximum number of milliseconds to wait1
if the call timed outjava.lang.InterruptedException
- If interrupted while waitingjava.sql.SQLException
- If a database access error occursCopyright © 2001-2024 Jaybird (Firebird JDBC) team. All rights reserved.