-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Madhur,

On 3/29/15 5:17 AM, Madhur Ahuja wrote:
> We have built a messaging server using PubNub which listens for
> chat messages from Android device. For this, our J2EE based spring,
> we have created a Pubnub listener (which is basically a listening
> socket) as follows.

If you have a component that opens its own socket, then it's not
really using Tomcat for anything. Someone here might be able to help,
but it sounds like this is not really Tomcat-related.

> However, we have observed is that our server stops listening 
> randomly after few days. The Tomcat keeps working fine, but just
> the socket stops listening. There is not error in logs.

Yup, it sounds like it's not Tomcat-related. I'll let some others on
the list with more Spring-related experience jump in and try to help.

- -chris

> Can anyone help in diagnosing this issue? Specifically, I want to
> ensure that the below design to initiate a listener is durable and
> not prone to errors.
> 
> public class IncomingListener implements ApplicationListener < 
> ContextRefreshedEvent > {
> 
> @Override public void onApplicationEvent(ContextRefreshedEvent
> event) {
> 
> private static volatile boolean isContextLoaded = false;
> 
> @Autowired ServletContext application;
> 
> synchronized(IncomingListener.class) {
> 
> if (isContextLoaded) { System.out.println("WTF: Not initializing
> incoming listener"); return; } try { initialiseIncomingListener(); 
> isContextLoaded = true; } catch (JSONException e) { 
> e.printStackTrace(); } catch (AkoshaException e) { 
> e.printStackTrace(); }
> 
> } }
> 
> private void initialiseIncomingListener() { // Initialize our
> Pubnub Listener
> 
> pubnub.subscribe(serverchannel, new Callback() {
> 
> // Subscribe to pubnub }); } }
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJVGJNBAAoJEBzwKT+lPKRY7GEP/2LLZL793xUJ286K2Td4i9W2
qv8XyvWKwzYkibSWKCgoAmZ5PiWSl+v/7Q7WoWkbi54yHMqwSekN53E1aKmWk7fB
LPkhghf/uu+WFur7c/2c6GGEkZXV7q1QTtNlibSgsSEyXA6wI00JnzNxwAP3HO0Q
iB8r3C8/K8bMyqEkXgE4kyWTOjoCq7eeL36060InJeM247sn1UB16AX6SKx8b/Bi
zY6QBjIbvwnLDEqwWy72FU2iebXzNV2etVwU0L5UuFP9LiidEZ7wCg27yhmIkUDG
rqYo5pFHbNjJA8U7oi+DPB5mvIcRiX6wqxJ77pucyEvX3rR/qO6UiOxcGtCjADjs
988wS0cThVOhPzF8T73vxPeUBbnjEQr2K7tzBEOd4GK4u620qoJHoxZ8MlhsxsCb
KGD6YlKkOKR4kHO3UbINwxXkWzyuTIE2hojOqgO2DyEVSUm479XUewWYq07hWmRA
mO8d4TIv/CQzt4TnWw3XIPsjxWZ/dt1ca6D7HtBjCvMldIAvgwPFe6S/DUOrOH5p
K72VVjyW+6xaJYR/98ZAa3USA9ondRDsZuCkoI/65QID3NpdlyOGw2cnGrTg654M
QobUC4mXkKFNCxD31q2zaZ0QzJO7sq6OqVq9F/Yer7Fo/ZS0mLP6EmOHCQj2dRv7
Tn+waNzIpDM28Ax3VoD7
=BEPH
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to