<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
We issue a disconnect before reconnect.&nbsp; It seems to me that throws an
exception since the socket is closed but in effect cleans up any
leftover state regarding the connection.<br>
<br>
On 7/27/2009 12:46 PM, Renee Mathur wrote:
<blockquote
 cite="mid:E0F62BEF7AA7794B81E38A3F319C328501158D76@SWAMAIL03.LUV.AD.SWACORP.COM"
 type="cite">
  <meta http-equiv="Content-Type"
 content="text/html; charset=ISO-8859-1">
  <meta name="Generator" content="Microsoft Word 11 (filtered medium)">
  <style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Georgia;
        panose-1:2 4 5 2 5 4 5 2 3 3;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
  </style>
  <div class="Section1">
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Hi.<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">I have an application
that performs like a Replicated Cache
and uses Spread 4.0 for messaging.<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">I have multiple instances
of my application and multiple
spread daemons in the environment.<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">In my application I have
a receive thread, that receives
messages from Spread.<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">I have code where, if I
get a socket exception on the
receive thread (the daemon has died or unable to connect to the daemon),<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">I do a disconnect and
then, I try to connect to other
daemons that may be running.<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">But, once my application
gets a Socket exception, when I try
to re-connect, I get an &#8220;Already Connected&#8221; SpreadException from
Spread.<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Looking through the
Spread source code
(SpreadConnection.java), I found, if the receive gets an exception, it
does not
set the &#8220;connected&#8221; Boolean to false.<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Subsequent disconnect
invoked by my application fails too, (since
it tries to send a Spread Message which would fail since the Socket has
been
closed from the daemon), which throws another SpreadException, but does
not set
connected to false. <o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Subsequent connect
invoked by my application, checks the
connected variable, and throws a SpreadException saying its &#8220;Already
Connected&#8221;.<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">I checked the source code
for 3.17, 4.0 and 4.1, and the
logic has not changed in any of the versions.<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Are there any work
arounds for this situation? How can my application
connect to a different daemon once its been disconnected?<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Any help/insight much
appreciated!<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font face="Georgia" size="2"><span
 style="font-size: 10pt; font-family: Georgia;">Thank you.</span></font><o:p></o:p></p>
  <p class="MsoNormal"><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">&nbsp;<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Georgia" size="2"><span
 style="font-size: 10pt; font-family: Georgia;">Regards,</span></font><o:p></o:p></p>
  <p class="MsoNormal"><strong><b><font face="Georgia" size="3"><span
 style="font-size: 12pt; font-family: Georgia;">Renee Mathur.</span></font></b></strong><o:p></o:p></p>
  <p class="MsoNormal"><font face="Georgia" size="2"><span
 style="font-size: 10pt; font-family: Georgia;">Contractor,</span></font><o:p></o:p></p>
  <p class="MsoNormal"><font face="Georgia" size="2"><span
 style="font-size: 10pt; font-family: Georgia;">Framework Support,
Technology Department,</span></font><o:p></o:p></p>
  <p class="MsoNormal"><font face="Georgia" size="2"><span
 style="font-size: 10pt; font-family: Georgia;">Southwest Airlines.</span></font><o:p></o:p></p>
  <p class="MsoNormal"><font face="Georgia" size="2"><span
 style="font-size: 10pt; font-family: Georgia;">Ph: (W) 214.792.4644</span></font><o:p></o:p></p>
  <p class="MsoNormal"><font face="Georgia" size="2"><span
 style="font-size: 10pt; font-family: Georgia;">Email: <a
 moz-do-not-send="true" href="mailto:renee.mathur@wnco.com">renee.mathur@wnco.com</a></span></font><o:p></o:p></p>
  <p class="MsoNormal"><font face="Georgia" size="2"><span
 style="font-size: 10pt; font-family: Georgia;">Website: <a
 moz-do-not-send="true" href="http://www.southwest.com">www.southwest.com</a></span></font><o:p></o:p></p>
  <p class="MsoNormal"><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;"><o:p>&nbsp;</o:p></span></font></p>
  </div>
  <hr size="1">
  <p><strong>
  <center>******* CONFIDENTIALITY NOTICE *******</center>
  <br>
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.
  </strong></p>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Spread-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Spread-users@lists.spread.org">Spread-users@lists.spread.org</a>
<a class="moz-txt-link-freetext" href="http://lists.spread.org/mailman/listinfo/spread-users">http://lists.spread.org/mailman/listinfo/spread-users</a>
  </pre>
</blockquote>
<br>
<br>
</body>
</html>