Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
joram
joram
Commits
9934b4f8
Commit
9934b4f8
authored
Jun 15, 2010
by
Guillaume Surrel
Browse files
Replace ClientMessages Vector and Enumeration with collection framework List and Iterator.
parent
02c16297
Changes
3
Hide whitespace changes
Inline
Side-by-side
joram/src/org/objectweb/joram/mom/dest/DestinationImpl.java
View file @
9934b4f8
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 200
9
ScalAgent Distributed Technologies
* Copyright (C) 2001 - 20
1
0 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
(
Enum
erat
ion
msgs
=
not
.
getMessages
().
elements
();
msgs
.
has
MoreElements
();)
{
msg
=
(
Message
)
msgs
.
next
Element
();
for
(
It
erat
or
msgs
=
not
.
getMessages
().
iterator
();
msgs
.
has
Next
();)
{
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
.
e
lementA
t
(
i
));
theCM
.
addMessage
((
Message
)
msgs
.
g
et
(
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/src/org/objectweb/joram/mom/dest/QueueImpl.java
View file @
9934b4f8
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 200
9
ScalAgent Distributed Technologies
* Copyright (C) 2001 - 20
1
0 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
(
Enum
erat
ion
msgs
=
clientMsgs
.
getMessages
().
elements
();
msgs
.
has
MoreElements
();)
{
for
(
It
erat
or
msgs
=
clientMsgs
.
getMessages
().
iterator
();
msgs
.
has
Next
();)
{
msg
=
new
Message
((
org
.
objectweb
.
joram
.
shared
.
messages
.
Message
)
msgs
.
next
Element
());
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
,
"
Collector
QueueImpl.storeClientMessage("
+
clientMsgs
+
')'
);
logger
.
log
(
BasicLevel
.
DEBUG
,
"QueueImpl.storeClientMessage("
+
clientMsgs
+
')'
);
if
(
clientMsgs
!=
null
)
{
Message
msg
;
// Storing each received message:
for
(
Enum
erat
ion
msgs
=
clientMsgs
.
getMessages
().
elements
();
msgs
.
has
MoreElements
();)
{
msg
=
new
Message
((
org
.
objectweb
.
joram
.
shared
.
messages
.
Message
)
msgs
.
next
Element
());
for
(
It
erat
or
msgs
=
clientMsgs
.
getMessages
().
iterator
();
msgs
.
has
Next
();)
{
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/src/org/objectweb/joram/mom/dest/TopicImpl.java
View file @
9934b4f8
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 200
9
ScalAgent Distributed Technologies
* Copyright (C) 2001 - 20
1
0 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
(
Enum
erat
ion
msgs
=
messages
.
elements
();
msgs
.
has
MoreElements
();)
deliverables
.
add
(((
Message
)
msgs
.
next
Element
()).
clone
());
for
(
It
erat
or
msgs
=
messages
.
iterator
();
msgs
.
has
Next
();)
deliverables
.
add
(((
Message
)
msgs
.
next
()).
clone
());
}
}
else
{
// Current subscriber filters messages; sending the matching messages.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment