Update of /cvsroot/mx4j/mx4j/src/core/mx4j/remote
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20656/core/mx4j/remote
Modified Files:
AbstractRemoteNotificationClientHandler.java
Log Message:
Made start() and stop() public, freed listeners tuples and improved logging
Index: AbstractRemoteNotificationClientHandler.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/core/mx4j/remote/AbstractRemoteNotificationClientHandler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AbstractRemoteNotificationClientHandler.java 24 Feb 2004 02:44:28 -0000 1.4
--- AbstractRemoteNotificationClientHandler.java 25 Feb 2004 13:38:16 -0000 1.5
***************
*** 66,71 ****
/**
* Returns whether this client handler is fetching notifications or not.
! * Notification fetching happens only when at least one tuple is added to this handler,
! * and stops as soon as no tuples remain in this handler
*/
public boolean isActive()
--- 66,71 ----
/**
* Returns whether this client handler is fetching notifications or not.
! * @see #start
! * @see #stop
*/
public boolean isActive()
***************
*** 74,79 ****
}
! private void start()
{
delivererThread.start();
fetcherThread.start();
--- 74,80 ----
}
! public void start()
{
+ if (isActive()) return;
delivererThread.start();
fetcherThread.start();
***************
*** 82,87 ****
--- 83,93 ----
public void stop()
{
+ if (!isActive()) return;
fetcherThread.stop();
delivererThread.stop();
+ synchronized (tuples)
+ {
+ tuples.clear();
+ }
}
***************
*** 147,152 ****
public void removeNotificationListeners(Integer[] ids)
{
! NotificationTuple tuple = null;
! boolean stop = false;
synchronized (tuples)
{
--- 153,157 ----
public void removeNotificationListeners(Integer[] ids)
{
! Logger logger = getLogger();
synchronized (tuples)
{
***************
*** 154,165 ****
{
Integer id = ids[i];
! tuple = (NotificationTuple)tuples.remove(id);
}
- stop = tuples.size() == 0;
}
- if (stop) stop();
-
- Logger logger = getLogger();
- if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Removing remote NotificationListener " + tuple);
}
--- 159,166 ----
{
Integer id = ids[i];
! NotificationTuple tuple = (NotificationTuple)tuples.remove(id);
! if (tuple != null && logger.isEnabledFor(Logger.DEBUG)) logger.debug("Removing remote NotificationListener " + tuple);
}
}
}
***************
*** 337,343 ****
public void run()
{
try
{
- Logger logger = getLogger();
while (isActive() && !thread.isInterrupted())
{
--- 338,344 ----
public void run()
{
+ Logger logger = getLogger();
try
{
while (isActive() && !thread.isInterrupted())
{
***************
*** 395,398 ****
--- 396,400 ----
{
AbstractRemoteNotificationClientHandler.this.stop();
+ if (logger.isEnabledFor(Logger.DEBUG)) logger.debug(thread.getName() + " Thread exited");
}
}
***************
*** 411,414 ****
--- 413,417 ----
while (true)
{
+ if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Fetching notifications, sequence is " + sequence + ", timeout is " + timeout);
try
{
***************
*** 469,472 ****
--- 472,476 ----
public void run()
{
+ Logger logger = getLogger();
try
{
***************
*** 490,494 ****
catch (Throwable x)
{
- Logger logger = getLogger();
if (logger.isEnabledFor(Logger.WARN)) logger.warn("Caught an unexpected exception", x);
}
--- 494,497 ----
***************
*** 498,501 ****
--- 501,505 ----
{
active = false;
+ if (logger.isEnabledFor(Logger.DEBUG)) logger.debug(thread.getName() + " Thread exited");
}
}
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.