|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.db.remote.ChangeNotificationClient
public class ChangeNotificationClient
provides an easy mechanism to setup a client for change notification on a database.
ChangeNotificationServer,
RemoteDBChangeNotifier,
RemoteDatabaseChangeHandler| Constructor Summary | |
|---|---|
ChangeNotificationClient(NetConnection con,
Database<?> db,
boolean deliverChanges)
starts a client daemon thread that listens to changes; if deliverChanges is true,
this client also propagates changes from the database to the server using a notifier. |
|
ChangeNotificationClient(String databaseName,
Database<?> db,
String server,
boolean deliverChanges)
|
|
ChangeNotificationClient(String databaseName,
Database<?> db,
String server,
int port,
boolean deliverChanges)
creates a SocketConnection to the server based on the given parameters and calls the constructor that takes a NetConnection |
|
| Method Summary | |
|---|---|
void |
addListener(DatabaseChangeListener l)
convenience method; delegates to the monitor |
void |
close()
stops/closes both, notifier and handler; removes all listeners and sets all member variables to null |
protected void |
finalize()
|
MessageDelegator |
getDelegator()
returns the delegator that uses the RemoteDatabaseChangeHandler, which has been started in its own daemon thread at construction time |
Thread |
getDelegatorThread()
returns the thread that runs the delegator |
RemoteDatabaseChangeHandler |
getHandler()
|
RemoteDBChangeNotifier |
getNotifier()
this is non-null only if this instance was created with deliverChanges set to true |
boolean |
removeListener(DatabaseChangeListener l)
convenience method; delegates to the monitor |
void |
setNotificationFilter(RemoteDBChangeFilter filter)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ChangeNotificationClient(String databaseName,
Database<?> db,
String server,
boolean deliverChanges)
throws IOException
IOException
public ChangeNotificationClient(String databaseName,
Database<?> db,
String server,
int port,
boolean deliverChanges)
throws IOException
databaseName - the name of the database that must correspond to the database name used by the ChangeNotificationServerdb - the database used to deliver the RemoteDBUpdateEvent instancesserver - the host that runs the ChangeNotificationServerport - the port on which the server runsdeliverChanges - if set to true, a DatabaseChangeMonitor is deployed to
propagate changes from the given database to the server for notification.
IOException
public ChangeNotificationClient(NetConnection con,
Database<?> db,
boolean deliverChanges)
throws IOException
deliverChanges is true,
this client also propagates changes from the database to the server using a notifier.
The handler is run by a MessageDelegator in a daemon thread.
The notifier (a RemoteDBChangeNotifier) is enabled through a DatabaseChangeMonitor
instance if applicable.
Note that if this also client delivers changes, it will receive updates only if the server
is set to send notifications to the same connection that delivered it.
con - the connection to the ChangeNotificationServerdb - the database used to deliver the RemoteDBUpdateEvent instancesdeliverChanges - if set to true, a DatabaseChangeMonitor is deployed to
propagate changes from the given database to the server for notification.
IOExceptionChangeNotificationServer.setDeliverToSelf(boolean),
DatabaseChangeMonitor| Method Detail |
|---|
public void setNotificationFilter(RemoteDBChangeFilter filter)
throws IOException
IOExceptionpublic RemoteDBChangeNotifier getNotifier()
deliverChanges set to true
public Thread getDelegatorThread()
getDelegator()public RemoteDatabaseChangeHandler getHandler()
public MessageDelegator getDelegator()
getDelegatorThread()public void addListener(DatabaseChangeListener l)
public boolean removeListener(DatabaseChangeListener l)
public void close()
close in interface Closeable
protected void finalize()
throws Throwable
finalize in class ObjectThrowable
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||