Help configuring server connection timeout

Hello I'm running JMS 3.6 SP3 in Windows and I'm trying to configure

the time it takes to generate a

[C4002]: Read packet failed. - cause: java.net.SocketException: Connection reset

message.

I've set up the following configuration, but it takes about 1:45-2:00 minutes to get the message.

Here's the configuration:

imqAddressList=mq://localhost:7676/jms

imqPingInterval=10

imqReconnectAttempts=-1

imqReconnectEnabled=true

imqReconnectInterval=10000

I would like this at around 30 seconds or less if possible.

Any help would be appreciated

[624 byte] By [Brian_Loughead] at [2007-11-26 10:49:10]
# 1
hi!what kind of configuration are you using? (jms, httpjms, httpsjms?), can you publish some of your code to try of replicate your problem?cy!
BuZMan at 2007-7-7 3:01:41 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 2

Thanks for the reply.

In regards to your queustion I am running as JMS as my configuration.

Here's me queue receiver code that you wanted to look at.

import javax.jms.*;

import javax.naming.NamingException;

import java.util.ArrayList;

import java.util.Iterator;

import java.util.List;

import java.util.Date;

public class QueueReceiver extends Thread implements ExceptionListener, JMSListener {

String queueName = null;

QueueConnectionFactory queueConnectionFactory = null;

javax.jms.Queue queue = null;

QueueConnection queueConnection = null;

QueueSession queueSession = null;

QueueReceiver queueReceiver = null;

TextMessage message = null;

TextListener textListener = null;

// List of listeners that will be started from the calling applications

private List listeners = new ArrayList();

public QueueReceiver(String queueName) {

// Store the queueName

this.queueName = queueName;

} // End of QueueReceiver

public void run() {

createConnection();

} // End of run()

public synchronized void addJMSListener(JMSListener l) {

listeners.add(l);

} // End of addJMSListener

public synchronized void removeJMSListener(JMSListener l) {

listeners.remove(l);

} // End of removeJMSListener

/**

* This event will fire off that something has occurred. This will then

* be picked up from the calling application

* @param message String The message to pass back.

*/

private synchronized void fireJMSEvent(String message) {

JMSEvent jmsEvent = new JMSEvent(this, message);

Iterator eventlisteners = listeners.iterator();

while (eventlisteners.hasNext()) {

((JMSListener) eventlisteners.next()).jmsReceived(jmsEvent);

}

} // End of fireJMSEvent

/**

* This onException event is activated with a JMSException from the JMS Server

* For a complete list of available codes refer to the JavaDevelopers Guide/

* @param e JMSException The exception.

*/

public void onException(JMSException e) {

if (e.getErrorCode() == "C4073") {

fireJMSEvent("Queue in use");

// Kill the Queue

queueConnection.close();

} else{

// This is for all other cases

fireJMSEvent("Network Error");

try{

queueConnection.close();

createConnection();

} catch (Exception ee) {

System.out.println("Attempting reconnection failure");

}

}

} //end onException

/**

* This will catch and throw the JMSEvents received by it.

*

* @param event JMSEvent The JMSEvent

*/

public void jmsReceived(JMSEvent event) {

// This event is from the TextListener stating that a message has been received

if (event.getMessage() == "Message Received") {

fireJMSEvent("Message Received");

}

} //End of jmsEvent

/**

*Create the connectio to the queue

*

*/

public void createConnection(){

boolean bolSkip = false;

if (queueConnectionFactory == null){

try {

queueConnectionFactory = SampleUtilities.getQueueConnectionFactory();

} catch (NamingException e) {

System.out.println("Exception = " + e.getMessage());

fireJMSEvent("Invalid name supplied");

bolSkip = true;

}

}

if (!bolSkip) {

try {

queueConnection = queueConnectionFactory.createQueueConnection();

queueConnection.setExceptionListener(this);

queueSession = queueConnection.createQueueSession(false,

Session.AUTO_ACKNOWLEDGE);

queue = (javax.jms.Queue) SampleUtilities.jndiLookup(queueName);

} catch (JMSException e) {

onException(e);

bolSkip = true;

} catch (Exception e) {

fireJMSEvent("Server not available");

bolSkip = true;

}

/*

* Create session and receiver.

* Register message listener (TextListener).

* Start message delivery; listener displays the message obtained.

* Only do this if everything above was ok.

*/

if (!bolSkip) {

try {

queueReceiver = queueSession.createReceiver(queue);

textListener = new TextListener();

textListener.addJMSListener(this);

queueReceiver.setMessageListener(textListener);

queueConnection.start();

// if successful to this point send back to calling app that the server is set up

fireJMSEvent("Server Started");

} catch (JMSException e) {

onException(e);

}

}

}

}

} // End of Class QueueReceiver

By the way what is the latest version of JMS for Windows?

Brian_Loughead at 2007-7-7 3:01:41 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 3

hi!

I'm not pretty sure about why to do yo need to control the connection reset time (with the ping interval you control time between test ping connection), but if I understand your post corrrectly, you are looking for the time for the broker to close a connection, and that could be different from the ping interval, and you want to control that, is that the question?

http://developers.sun.com/sw/docs/articles/integration/tuning_impact.html

the imq.protocol..nodelay should be interesting for you then (that will explain you observe different timeout time, the default value is controled by Nagle's algorithm).

hope that work!

PS.: just by curiosity, what are you building? : P

BuZMan at 2007-7-7 3:01:41 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 4

ops! I forget to mention, that you are not using the last version of imq, if you want, dowload the last version (enterprise edition) from:

https://mq.dev.java.net/

as a personal opinion, I don't have any good reazon, at least for the use of the company I work for, to migrate from 3.6 to 4.0, anyway we test our systems in 3.6SP4 and 4.0b10 (it's really easy to change version, so we are still testing 4.0 to use it production enviroment...)

bye!

BuZMan at 2007-7-7 3:01:41 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 5
How do set the nodelay property?
Sebastienz at 2007-7-7 3:01:41 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 6
in linux:/opt/sun/var/instance/imqbroker/props/config.properties(what I remember)imq.protocol.tcp.nodelay=falsegood luck!
BuZMan at 2007-7-7 3:01:41 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...