Commit 9934b4f8 authored by Guillaume Surrel's avatar Guillaume Surrel
Browse files

Replace ClientMessages Vector and Enumeration with collection framework List and Iterator.

parent 02c16297
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2009 ScalAgent Distributed Technologies
* Copyright (C) 2001 - 2010 ScalAgent Distributed Technologies
* Copyright (C) 1996 - 2000 Dyade
*
* This library is free software; you can redistribute it and/or
......@@ -27,6 +27,8 @@ import java.io.IOException;
import java.util.Date;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Vector;
......@@ -551,8 +553,8 @@ public abstract class DestinationImpl implements java.io.Serializable, Destinati
if (!isWriter(from)) {
DMQManager dmqManager = new DMQManager(not.getDMQId(), dmqId, getId());
Message msg;
for (Enumeration msgs = not.getMessages().elements(); msgs.hasMoreElements();) {
msg = (Message) msgs.nextElement();
for (Iterator msgs = not.getMessages().iterator(); msgs.hasNext();) {
msg = (Message) msgs.next();
nbMsgsSentToDMQSinceCreation++;
dmqManager.addDeadMessage(msg, MessageErrorConstants.NOT_WRITEABLE);
handleDeniedMessage(msg.id, AgentId.fromString(msg.replyToId));
......@@ -674,9 +676,9 @@ public abstract class DestinationImpl implements java.io.Serializable, Destinati
theCM.getRequestId()));
while (en.hasMoreElements()) {
ClientMessages cm = (ClientMessages) en.nextElement();
Vector msgs = cm.getMessages();
List msgs = cm.getMessages();
for (int i = 0; i < msgs.size(); i++) {
theCM.addMessage((Message) msgs.elementAt(i));
theCM.addMessage((Message) msgs.get(i));
}
if (! cm.getAsyncSend()) {
replies.addElement(new SendReplyNot(
......@@ -862,6 +864,10 @@ public abstract class DestinationImpl implements java.io.Serializable, Destinati
return null;
}
public AgentId getDMQAgentId() {
return dmqId;
}
/**
* Returns this destination creation time as a long.
*
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2009 ScalAgent Distributed Technologies
* Copyright (C) 2001 - 2010 ScalAgent Distributed Technologies
* Copyright (C) 1996 - 2000 Dyade
*
* This library is free software; you can redistribute it and/or
......@@ -927,9 +927,9 @@ public class QueueImpl extends DestinationImpl implements QueueImplMBean {
if (clientMsgs != null) {
Message msg;
// Storing each received message:
for (Enumeration msgs = clientMsgs.getMessages().elements(); msgs.hasMoreElements();) {
for (Iterator msgs = clientMsgs.getMessages().iterator(); msgs.hasNext();) {
msg = new Message((org.objectweb.joram.shared.messages.Message) msgs.nextElement());
msg = new Message((org.objectweb.joram.shared.messages.Message) msgs.next());
msg.order = arrivalsCounter++;
storeMessage(msg);
......@@ -1451,13 +1451,13 @@ public class QueueImpl extends DestinationImpl implements QueueImplMBean {
*/
public void addClientMessages(ClientMessages clientMsgs) {
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "CollectorQueueImpl.storeClientMessage(" + clientMsgs + ')');
logger.log(BasicLevel.DEBUG, "QueueImpl.storeClientMessage(" + clientMsgs + ')');
if (clientMsgs != null) {
Message msg;
// Storing each received message:
for (Enumeration msgs = clientMsgs.getMessages().elements(); msgs.hasMoreElements();) {
msg = new Message((org.objectweb.joram.shared.messages.Message) msgs.nextElement());
for (Iterator msgs = clientMsgs.getMessages().iterator(); msgs.hasNext();) {
msg = new Message((org.objectweb.joram.shared.messages.Message) msgs.next());
msg.order = arrivalsCounter++;
storeMessage(msg);
}
......@@ -1491,7 +1491,7 @@ public class QueueImpl extends DestinationImpl implements QueueImplMBean {
protected void handleExpiredNot(AgentId from, ExpiredNot not) {
Notification expiredNot = not.getExpiredNot();
Vector messages;
List messages;
// ClientMessages and TopicMsgsReply are the notifications which can expire in the networks.
// QueueMsgReply can't expire due to protocol limitations
if (expiredNot instanceof ClientMessages) {
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2009 ScalAgent Distributed Technologies
* Copyright (C) 2001 - 2010 ScalAgent Distributed Technologies
* Copyright (C) 2003 - 2004 Bull SA
* Copyright (C) 1996 - 2000 Dyade
*
......@@ -28,6 +28,7 @@ import java.util.Enumeration;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.Vector;
......@@ -792,11 +793,11 @@ public class TopicImpl extends DestinationImpl implements TopicImplMBean {
* to the valid subscribers.
*/
protected void processMessages(ClientMessages not) {
Vector messages = not.getMessages();
List messages = not.getMessages();
AgentId subscriber;
boolean local;
String selector;
Vector deliverables;
List deliverables;
Message message;
nbMsgsReceiveSinceCreation = nbMsgsReceiveSinceCreation + messages.size();
......@@ -825,8 +826,8 @@ public class TopicImpl extends DestinationImpl implements TopicImplMBean {
// A local sending already occurred: cloning the messages.
else {
deliverables = new Vector();
for (Enumeration msgs = messages.elements(); msgs.hasMoreElements();)
deliverables.add(((Message) msgs.nextElement()).clone());
for (Iterator msgs = messages.iterator(); msgs.hasNext();)
deliverables.add(((Message) msgs.next()).clone());
}
} else {
// Current subscriber filters messages; sending the matching messages.
......
Supports Markdown
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