It seems attached files are removing automatically. This is the class.
---
package com.aqs.queuetest;
import javax.jms.*;
import javax.naming.*;
import javax.rmi.*;
import java.rmi.*;
import java.io.*;
public class TestSender {
QueueConnectionFactory factory;
QueueConnection queueConnection;
Queue queue;
long sleep;
public TestSender (long sleep) {
Context context = null;
try {
this.sleep = sleep;
// The jndi.properties file contains:
// java.naming.provider.url=ejipt://ernestobv:2300
// java.naming.factory.initial=allaire.ejipt.ContextFactory
context = new InitialContext();
factory = (QueueConnectionFactory)
PortableRemoteObject.narrow(context.lookup(QueueConnectionFactory.class.getName()),
QueueConnectionFactory.class);
queueConnection = factory.createQueueConnection ();
QueueSession session = queueConnection.createQueueSession (true,
Session.AUTO_ACKNOWLEDGE);
queue = session.createQueue ("test");
session.close ();
queueConnection.start ();
} catch (Exception e) {
e.printStackTrace ();
System.exit (-1);
} finally {
if (context != null) {
try {
context.close ();
} catch (NamingException ne) {
ne.printStackTrace ();
}
}
}
}
public void send () {
long start = System.currentTimeMillis();
int i = 0;
while (true) {
try {
QueueSession session = queueConnection.createQueueSession (true,
Session.AUTO_ACKNOWLEDGE);
QueueSender sender = session.createSender(queue);
TextMessage msg;
msg = session.createTextMessage ();
msg.setText ("mensaje " + (i));
i++;
sender.send (msg, DeliveryMode.PERSISTENT , 0, 0);
System.out.println ("�");
sender.close ();
session.close ();
Thread.sleep (sleep);
} catch (Exception e) {
e.printStackTrace ();
System.out.println ();
System.out.println ((System.currentTimeMillis() - start) + " ms.");
System.exit (-1);
}
}
}
public static void main (String [] args) {
System.setSecurityManager (new RMISecurityManager());
TestSender sender = new TestSender (1000);
sender.send ();
}
}
---
Regards,
C�sar.
C�sar �lvarez N��ez wrote:
> Hello,
>
> We are testing the JRun JMS implementation with a simple class which
> sends one text messages per second to a queue.
> However, after 120000 ms. (approximately) an InvalidTransactionException
> is thrown.
>
> That's annoying due to the simplicity of the test (the class is attached
> on a zip file).
>
> What's wrong on the code? At the end of the week we should release a new
> version of our product, but we are blocked with the mentioned problem.
>
> Any help would be appreciated?
>
> Regards,
> C�sar.
>
> ---
> Exception: [17:51:09] java.lang.IllegalStateException: Invalid or
> expired transaction
> java.lang.IllegalStateException: Invalid or expired transaction
> at
> allaire.ejipt._jta._Transaction.registerSynchronization(_Transaction.java:200)
>
> at allaire.ejipt._SessionContext._register(_SessionContext.java:68)
> at allaire.ejipt._SessionObject._invoke(_SessionObject.java:179)
> at allaire.ejipt._CallableObject.call(_CallableObject.java:101)
> at java.lang.reflect.Method.invoke(Native Method)
> at
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java(Compiled
> Code))
> at sun.rmi.transport.Transport$1.run(Transport.java:155)
> at java.security.AccessController.doPrivileged(Native Method)
> at sun.rmi.transport.Transport.serviceCall(Transport.java:152)
> at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:462)
>
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:662)
>
> at java.lang.Thread.run(Thread.java:498)
> ---
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists