[Design of Messaging on JBoss (Messaging/JBoss)] - Re: JMSMessage.ack call is equivalent to JMSSession.commit()
by clebert.suconic@jboss.com
It should be a simple fix, but to fix that I would need access to JBossSession from JBossMessage, or the ACKMode as a property on JBossMessage.
This is the complete test:
| class AcknowledgementTest
| ....
|
|
| public void testTransactionalAcknowledgementClientCallingACK() throws Exception
| {
| Connection conn = null;
|
| try
| {
| conn = cf.createConnection();
|
| Session producerSess = conn.createSession(true, Session.SESSION_TRANSACTED);
| MessageProducer producer = producerSess.createProducer(queue1);
|
| Session consumerSess = conn.createSession(true, Session.SESSION_TRANSACTED);
| MessageConsumer consumer = consumerSess.createConsumer(queue1);
| conn.start();
|
| final int NUM_MESSAGES = 20;
|
| // Send some messages
| for (int i = 0; i < NUM_MESSAGES; i++)
| {
| Message m = producerSess.createMessage();
| //m.acknowledge(); // This is invalid but this call should be ignored accordingly to the javadoc
| producer.send(m);
| }
|
| assertRemainingMessages(0);
|
| producerSess.rollback();
|
| // Send some messages
| for (int i = 0; i < NUM_MESSAGES; i++)
| {
| Message m = producerSess.createMessage();
| producer.send(m);
| }
| assertRemainingMessages(0);
|
| producerSess.commit();
|
| assertRemainingMessages(NUM_MESSAGES);
|
|
| int count = 0;
| while (true)
| {
| Message m = consumer.receive(200);
| if (m == null)
| {
| break;
| }
| m.acknowledge();
| count++;
| }
|
| assertRemainingMessages(NUM_MESSAGES);
|
| assertEquals(count, NUM_MESSAGES);
|
| consumerSess.rollback();
|
| assertRemainingMessages(NUM_MESSAGES);
|
| int i = 0;
| for (; i < NUM_MESSAGES; i++)
| {
| consumer.receive();
| }
|
| assertRemainingMessages(NUM_MESSAGES);
|
| // if I don't receive enough messages, the test will timeout
|
| consumerSess.commit();
|
| assertRemainingMessages(0);
|
| checkEmpty(queue1);
| }
| finally
| {
| if (conn != null)
| {
| conn.close();
| }
| }
| }
|
|
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4221139#4221139
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4221139
15 years, 1 month
[Design of JBossCache] - Re: Common marshalling infrastructure
by galder.zamarreno@jboss.com
"david.lloyd(a)jboss.com" wrote : "galder.zamarreno(a)jboss.com" wrote : 2.- Looking at JBoss Marshalling, I saw that you're considering primitive arrays as known classes but primitive object arrays are not. Is this an oversight or on purpose? i.e.
| |
| | map.put(Byte[].class, Protocol.ID_BYTE_ARRAY_CLASS);
| | | map.put(Boolean[].class, Protocol.ID_BOOLEAN_ARRAY_CLASS);
| | | map.put(Character[].class, Protocol.ID_CHAR_ARRAY_CLASS);
| | | ...
| |
|
| The reason for this is that primitive array classes do not extend the object array class. Since all object arrays are represented by a single byte plus the component type information, there should be one byte to signify the array plus one byte for the primitive wrapper, which is two bytes (not too bad). Likewise, e.g. Byte[][].class would be three bytes, etc. If the length is still unacceptably long, a ClassTable can be used to reduce it down to a single byte.
|
|
Yeah, but the problem here is that aftewards, you're treating Primitive Object arrays as serializable and you're not taken advantage of the same performance gains that you applied to primitive arrays.
IOW, in RiverMarshaller.doWriteObject, primitive arrays are treated specially and this is done based on class id coming BASIC_CLASSES. Now, if you don't give the same class IDs or paralell ones to primitive object arrays (Byte[], Integer[]...etc), you're missing out on a performance improvement gain.
Currently, looks to me primitive object arrays would be treated as Serializable.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4221109#4221109
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4221109
15 years, 1 month