Commit c998909e authored by Robin Collier's avatar Robin Collier Committed by rcollier

OF-205 Put synchronization in place on realization of transient members.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13308 b35dd754-fafc-0310-a699-88a17e54d16e
parent 2c8e2d71
......@@ -75,7 +75,7 @@ public class PublishedItem implements Serializable {
/**
* The node where the item was published.
*/
private transient LeafNode node;
private volatile transient LeafNode node;
/**
* The id for the node where the item was published.
*/
......@@ -96,7 +96,7 @@ public class PublishedItem implements Serializable {
* The optional payload is included when publishing the item. This value
* is created from the payload XML and cached as/when needed.
*/
private transient Element payload;
private volatile transient Element payload;
/**
* XML representation of the payload (for serialization)
*/
......@@ -127,12 +127,19 @@ public class PublishedItem implements Serializable {
*/
public LeafNode getNode() {
if (node == null) {
if (Node.PUBSUB_SVC_ID.equals(serviceId)) {
synchronized (this) {
if (node == null) {
if (Node.PUBSUB_SVC_ID.equals(serviceId))
{
node = (LeafNode) XMPPServer.getInstance().getPubSubModule().getNode(nodeId);
} else {
}
else
{
PEPServiceManager serviceMgr = XMPPServer.getInstance().getIQPEPHandler().getServiceManager();
node = serviceMgr.hasCachedService(new JID(serviceId)) ?
(LeafNode) serviceMgr.getPEPService(serviceId).getNode(nodeId) : null;
node = serviceMgr.hasCachedService(new JID(serviceId)) ? (LeafNode) serviceMgr.getPEPService(
serviceId).getNode(nodeId) : null;
}
}
}
}
return node;
......@@ -174,6 +181,8 @@ public class PublishedItem implements Serializable {
*/
public Element getPayload() {
if (payload == null && payloadXML != null) {
synchronized (this) {
if (payload == null) {
// payload initialized as XML string from DB
SAXReader xmlReader = null;
try {
......@@ -187,6 +196,8 @@ public class PublishedItem implements Serializable {
}
}
}
}
}
return payload;
}
......
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