Commit 9b0fae44 authored by Andre Freyssinet's avatar Andre Freyssinet

Bug fix: JORAM-304.

parent 26d86d4a
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2006 - 2016 ScalAgent Distributed Technologies
* Copyright (C) 2006 - 2018 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -52,7 +52,7 @@ import fr.dyade.aaa.util.Transaction;
* A message content is always wrapped as a bytes array, it is characterized
* by properties and "header" fields.
*/
public final class Message implements Serializable, MessageView, Encodable {
public final class Message implements Serializable, Encodable {
/** define serialVersionUID for interoperability */
private static final long serialVersionUID = 2L;
......@@ -566,8 +566,8 @@ public final class Message implements Serializable, MessageView, Encodable {
try {
return msg.getText();
} catch (Exception e) {
if (logger.isLoggable(BasicLevel.WARN))
logger.log(BasicLevel.WARN, "getText()", e);
if (logger.isLoggable(BasicLevel.INFO))
logger.log(BasicLevel.INFO, "getText()", e);
return null;
}
}
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2010 ScalAgent Distributed Technologies
* Copyright (C) 2010 - 2018 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -24,10 +24,10 @@ package org.objectweb.joram.mom.messages;
import java.util.Map;
/**
* Allows to observe a message.
*/
public interface MessageView {
public String getText();
public int getType();
public int getPriority();
......@@ -44,6 +44,7 @@ public interface MessageView {
public String getId();
public String getText();
public Map getProperties();
}
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2003 - 2016 ScalAgent Distributed Technologies
* Copyright (C) 2003 - 2018 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -39,6 +39,7 @@ import javax.management.openmbean.TabularData;
import org.objectweb.joram.mom.dest.Queue;
import org.objectweb.joram.mom.messages.Message;
import org.objectweb.joram.mom.messages.MessageJMXWrapper;
import org.objectweb.joram.mom.messages.MessageView;
import org.objectweb.joram.mom.util.DMQManager;
import org.objectweb.joram.mom.util.JoramHelper;
import org.objectweb.joram.mom.util.MessageIdList;
......@@ -66,7 +67,7 @@ import fr.dyade.aaa.common.encoding.Encoder;
* subscription, and the methods managing the delivery and acknowledgement
* of the messages.
*/
class ClientSubscription implements ClientSubscriptionMBean, Serializable, Encodable {
public class ClientSubscription implements ClientSubscriptionMBean, Serializable, Encodable {
/** define serialVersionUID for interoperability */
private static final long serialVersionUID = 1L;
......@@ -1087,8 +1088,8 @@ class ClientSubscription implements ClientSubscriptionMBean, Serializable, Encod
return MessageJMXWrapper.createTabularDataSupport(messagesTable.getMap(), messageIds);
}
public List getMessagesView() {
List messages = new ArrayList();
public List<MessageView> getMessagesView() {
List messages = new ArrayList<MessageView>();
// DF: should be avoided with swap... (check the table type?)
for (int i = 0; i < messageIds.size(); i++) {
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2006 - 2013 ScalAgent Distributed Technologies
* Copyright (C) 2006 - 2018 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -354,9 +354,10 @@ public final class Message implements Cloneable, Serializable, Streamable, Encod
obj = ois.readObject();
}
} catch (Exception exc) {
if (logger.isLoggable(BasicLevel.ERROR))
logger.log(BasicLevel.ERROR, "ERROR: fromBytes(body)", exc);
// Don't forget to rethrow the Exception
if (logger.isLoggable(BasicLevel.INFO))
logger.log(BasicLevel.INFO, "ERROR: fromBytes(body) -> " + id, exc);
else
logger.log(BasicLevel.WARN, "ERROR: fromBytes(body) -> " + id);
throw exc;
} finally {
try {
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2012 - ScalAgent Distributed Technologies
* Copyright (C) 2012 - 2018 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -1192,7 +1192,7 @@ public class MOMCommandsImpl implements MOMCommands {
private List<MessageView> getQueueMessages(String queueName) throws QueueNotFoundException {
QueueMBean queue = findQueue(queueName);
@SuppressWarnings("unchecked")
List<MessageView> msgs = queue.getMessagesView();
List<MessageView> msgs = ((org.objectweb.joram.mom.dest.Queue) queue).getMessagesView();
return msgs==null?new ArrayList<MessageView>():msgs;
}
......@@ -1207,7 +1207,7 @@ public class MOMCommandsImpl implements MOMCommands {
private List<MessageView> getSubscriptionMessages(String userName, String subscriptionName) throws UserNotFoundException, SubscriptionNotFoundException {
ClientSubscriptionMBean sub = findClientSubscription(userName, subscriptionName);
@SuppressWarnings("unchecked")
List<MessageView> msgs = sub.getMessagesView();
List<MessageView> msgs = ((org.objectweb.joram.mom.proxies.ClientSubscription) sub).getMessagesView();
return msgs==null?new ArrayList<MessageView>():msgs;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment