"richieb" wrote : "lucasfowler" wrote : Thanks for the infos here.
  |   | 
  |   | We have added an exceptionListener and that seems to have done the trick.
  | 
  | And what does your listener do?
  | 
  | ...richie

OK, we are running in a servlet so we can't start another thread. So we
set up the listener to set a flag and changed the read method to timeout
every so often. That way, if there is a connection failure we can close
properly in our finally clause and then get the client to reconnect.


            topicConnection.setExceptionListener( new ExceptionListener() {
                    public void onException( JMSException e ) {
                        logger.logError( sessionLog( request, "Connection failed: " + 
e.getMessage() ) );
                        topicConnectionStatus.setOk( false );
                    }
                });     

            // Continously pass 'retrieved' responses back to the client.
            while ( topicConnectionStatus.isOk() ) {
                // Receive response from ResponseStream topic.
                // The receive method is called with timeout so we may check from time 
to time if the
                // connection listener detected a connection failure.
                ObjectMessage message = (ObjectMessage)topicSubscriber.receive( 
topicReveiveTimeout );

                ... do stuff
              }

        } finally {

            if ( topicConnection != null ) {
                try {
                    topicConnection.close();
        ...

Hope this helps

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3829205#3829205

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3829205


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to