mx4j/src/core/mx4j/remote DefaultRemoteNotificationServerHandler.java,1.8,1.9

Simone Bordet <[email protected]>
Newsgroups gmane.comp.java.mx4j.cvs
Message-ID <[email protected]>
Update of /cvsroot/mx4j/mx4j/src/core/mx4j/remote
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24905/src/core/mx4j/remote

Modified Files:
	DefaultRemoteNotificationServerHandler.java 
Log Message:
Fixed bug in case of closing of connector server: fetchNotification() was busy looping (especially with SOAPConnectorServer)

Index: DefaultRemoteNotificationServerHandler.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/core/mx4j/remote/DefaultRemoteNotificationServerHandler.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** DefaultRemoteNotificationServerHandler.java	25 Feb 2004 16:43:30 -0000	1.8
--- DefaultRemoteNotificationServerHandler.java	18 Jul 2004 21:06:08 -0000	1.9
***************
*** 9,29 ****
  package mx4j.remote;
  
  import java.util.HashMap;
  import java.util.LinkedList;
  import java.util.List;
  import java.util.Map;
- 
  import javax.management.Notification;
  import javax.management.NotificationListener;
  import javax.management.ObjectName;
- import javax.management.NotificationFilter;
  import javax.management.remote.NotificationResult;
  import javax.management.remote.TargetedNotification;
  
- import mx4j.log.Logger;
  import mx4j.log.Log;
  
  /**
   * Base implementation of the RemoteNotificationServerHandler interface.
   * @author <a href="mailto:[email protected]">Simone Bordet</a>
   * @version $Revision$
--- 9,31 ----
  package mx4j.remote;
  
+ import java.io.IOException;
+ import java.util.Arrays;
  import java.util.HashMap;
  import java.util.LinkedList;
  import java.util.List;
  import java.util.Map;
  import javax.management.Notification;
+ import javax.management.NotificationFilter;
  import javax.management.NotificationListener;
  import javax.management.ObjectName;
  import javax.management.remote.NotificationResult;
  import javax.management.remote.TargetedNotification;
  
  import mx4j.log.Log;
+ import mx4j.log.Logger;
  
  /**
   * Base implementation of the RemoteNotificationServerHandler interface.
+  *
   * @author <a href="mailto:[email protected]">Simone Bordet</a>
   * @version $Revision$
***************
*** 40,43 ****
--- 42,46 ----
     /**
      * Creates a new remote notification server handler.
+     *
      * @param environment Contains environment variables used to configure this handler
      * @see MX4JRemoteConstants#NOTIFICATION_BUFFER_CAPACITY
***************
*** 81,86 ****
     }
  
!    public NotificationResult fetchNotifications(long sequenceNumber, int maxNotifications, long timeout)
     {
        return buffer.getNotifications(sequenceNumber, maxNotifications, timeout);
     }
--- 84,90 ----
     }
  
!    public NotificationResult fetchNotifications(long sequenceNumber, int maxNotifications, long timeout) throws IOException
     {
+       if (closed) throw new IOException("RemoteNotificationServerHandler is closed");
        return buffer.getNotifications(sequenceNumber, maxNotifications, timeout);
     }
***************
*** 88,91 ****
--- 92,96 ----
     public NotificationTuple[] close()
     {
+       Logger logger = getLogger();
        closed = true;
        stopWaitingForNotifications(buffer);
***************
*** 94,97 ****
--- 99,103 ----
           NotificationTuple[] result = (NotificationTuple[])tuples.values().toArray(new NotificationTuple[tuples.size()]);
           tuples.clear();
+          if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("RemoteNotificationServerHandler closed, returning: " + Arrays.asList(result));
           return result;
        }
***************
*** 102,105 ****
--- 108,112 ----
      * {@link #waitForNotifications}, so here we wake it up, letting the thread return to the
      * client and free resources on client's side.
+     *
      * @param lock The object on which {@link #notifyAll} should be called
      */
***************
*** 119,123 ****
      * will be returned to the client), or false if no notifications should be sent to
      * the client.
!     * @param lock The object on which {@link #wait} should be called
      * @param timeout The amount of time to wait (guaranteed to be strictly greater than 0)
      */
--- 126,131 ----
      * will be returned to the client), or false if no notifications should be sent to
      * the client.
!     *
!     * @param lock    The object on which {@link #wait} should be called
      * @param timeout The amount of time to wait (guaranteed to be strictly greater than 0)
      */



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&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.