[Spread-users] SpreadException: spread.SpreadException: Connection closed while reading header
Renee Mathur
Renee.Mathur at wnco.com
Wed Dec 30 12:59:28 EST 2009
Also attaching the excerpt of the actual fix made:
File: java\spread\SpreadConnection.java
Method: synchronized public void disconnect() throws SpreadException
Code change:
synchronized public void disconnect() throws SpreadException
{
// Check if we're connected.
////////////////////////////
if(connected == false)
{
throw new SpreadException("Not connected.");
}
// Are we in a listener callback?
/////////////////////////////////
if(callingListeners)
{
// Add it to the command buffer.
////////////////////////////////
listenerBuffer.addElement(BUFFER_DISCONNECT);
// Don't need to do anything else.
//////////////////////////////////
return;
}
try
{
// Get a new message.
/////////////////////
SpreadMessage killMessage = new
SpreadMessage();
// Send it to our private group.
////////////////////////////////
killMessage.addGroup(group);
// Set the service type.
////////////////////////
killMessage.setServiceType(SpreadMessage.KILL_MESS);
// Send the message.
////////////////////
multicast(killMessage);
// Check for a listener thread.
///////////////////////////////
if(listener != null)
{
// Stop it.
///////////
stopListener();
}
// Close the socket.
////////////////////
try
{
socket.close();
}
catch(IOException e)
{
throw new
SpreadException("close(): " + e);
}
}
finally
{
connected = false;
}
}
Thank you.
Regards,
Renee Mathur.
Contractor,
Framework Support, Technology Department,
Southwest Airlines.
Ph: (W) 214.792.4644
Email: renee.mathur at wnco.com
Website: www.southwest.com
-----Original Message-----
From: Renee Mathur
Sent: Wednesday, December 30, 2009 11:44 AM
To: 'mdistefano at integrasoftware.com'
Cc: spread-users at lists.spread.org
Subject: RE: [Spread-users] SpreadException: spread.SpreadException:
Connection closed while reading header
Hi Michael,
Sorry for the late response.
I've attached the code change I had made to make reconnection possible,
once a Spread client disconnected from the daemon.
It's a change in the disconnect method to ensure regardless of
exceptions thrown, the Boolean variable 'connected' is always reset.
I had sent the code for being encorporated in the next Spread release as
well.
Hope this helps.
Thank you.
Regards,
Renee Mathur.
Contractor,
Framework Support, Technology Department,
Southwest Airlines.
Ph: (W) 214.792.4644
Email: renee.mathur at wnco.com
Website: www.southwest.com
-----Original Message-----
From: Michael Di Stefano [mailto:mdistefano at integrasoftware.com]
Sent: Monday, November 30, 2009 4:19 PM
To: Renee Mathur
Cc: spread-users at lists.spread.org
Subject: Re: [Spread-users] SpreadException: spread.SpreadException:
Connection closed while reading header
Renee
Thank you for help, your and Andrew Gilmartin's responses pointed me to
where the exception is being thrown and not caught. I download the
source for 4.1 and see in the java client code
SpreadConnection.java file Class Listener - run() method line 1637
SpreadConnection:internalreceive() is being called but SpreadException
is not caught.
My application layer wraps spread such that it manages load balancing
among the spread server cluster. The desired behavior is that if a
server connection is lost then attempt a reconnect to another server in
the cluster. Given the above, I see no way to get control back to my
code to manage reconnects. I guess my only option is to simply exit().
This brings me to my next "feature". When I detect a closed connection
on a send, I can not reconnect to any server, the message is that I am
already connected. This sounds like boolean variable check you describe
below.
If you can please send me that code I would appreciate it.
Regards
Michael
Renee Mathur wrote:
> There is a bug in the client side piece of Spread-4.0.jar where it
does not clear the state of a boolean variable if the spread daemon
dies. Reconnection logic just checks for the boolean variable and if
its' true, it assumed it's already connected, and does not attempt a
re-connection.
> I'd sent an email about this to the spread group about 2-3 months back
along with a fix to the source code.
> Let me know if you can't find it. I should be able to dig it for you -
but only after I get back from my vacation in late Dec.
> Regards,
> Renee.
>
>
> ________________________________
>
> From: spread-users-bounces at lists.spread.org on behalf of Michael Di
Stefano
> Sent: Sat 11/28/2009 12:51 PM
> To: spread-users at lists.spread.org
> Subject: [Spread-users] SpreadException: spread.SpreadException:
Connection closed while reading header
>
>
>
> Hi
>
> I am testing my application for error conditions and purposefully
> killing the spread server. There is no message activity, the
> application is just sitting listening for a message. (I am using a
> Basic Message Listener)
>
> When I kill the server I get
>
> SpreadException: spread.SpreadException: Connection closed while
> reading header
>
> printed to standard out. I do not seem to be able to find where this
> exception is being thrown/printed and where to catch the exception so
I
> can exit my program.
>
> My environment is
>
> --- spread server is running on a MAC
> --- Application is a written in Java using spread-4.0.0.jar
>
> Any advise is appreciated.
>
> Thanks
>
> Michael
>
>
>
>
>
>
>
>
>
>
>
>
> ******* CONFIDENTIALITY NOTICE *******
>
> This e-mail message and all attachments transmitted with it may
> contain legally privileged and confidential information intended
> solely for the use of the addressee. If the reader of this message
> is not the intended recipient, you are hereby notified that any
> reading, dissemination, distribution, copying, or other use of this
> message or its attachments is strictly prohibited. If you have
> received this message in error, please notify the sender
> immediately and delete this message from your system. Thank you.
More information about the Spread-users
mailing list