Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
View
71 src/org/exist/dom/ElementImpl.java
@@ -425,8 +425,13 @@ public Node appendChild(Node child) throws DOMException {
transact.abort(transaction);
throw new DOMException(DOMException.INVALID_STATE_ERR, e.getMessage());
} finally {
- transact.close(transaction);
- ownerDocument.getBrokerPool().release(broker);
+ if (broker != null) {
+ try {
+ transact.close(transaction);
+ } finally {
+ broker.release();
+ }
+ }
}
}
@@ -502,7 +507,8 @@ public void appendChildren(Txn transaction, NodeList nodes, int child) throws DO
} catch (final EXistException e) {
LOG.warn("Exception while appending child node: " + e.getMessage(), e);
} finally {
- ownerDocument.getBrokerPool().release(broker);
+ if (broker != null)
+ broker.release();
}
}
@@ -658,7 +664,8 @@ private Node appendChild(Txn transaction, NodeId newNodeId, NodeImplRef last, No
} catch (final EXistException e) {
LOG.warn("Exception while appending node: " + e.getMessage(), e);
} finally {
- ownerDocument.getBrokerPool().release(broker);
+ if (broker != null)
+ broker.release();
}
return null;
}
@@ -737,7 +744,8 @@ public NamedNodeMap getAttributes() {
} catch (final EXistException e) {
LOG.warn("Exception while retrieving attributes: " + e.getMessage());
} finally {
- ownerDocument.getBrokerPool().release(broker);
+ if (broker != null)
+ broker.release();
}
}
if (declaresNamespacePrefixes()) {
@@ -765,7 +773,8 @@ private AttrImpl findAttribute(String qname) {
} catch (final EXistException e) {
LOG.warn("Exception while retrieving attributes: " + e.getMessage());
} finally {
- ownerDocument.getBrokerPool().release(broker);
+ if (broker != null)
+ broker.release();
}
return null;
}
@@ -793,7 +802,8 @@ private AttrImpl findAttribute(QName qname) {
} catch (final EXistException e) {
LOG.warn("Exception while retrieving attributes: " + e.getMessage());
} finally {
- ownerDocument.getBrokerPool().release(broker);
+ if (broker != null)
+ broker.release();
}
return null;
}
@@ -866,7 +876,8 @@ public NodeList getChildNodes() {
} catch (final EXistException e) {
LOG.warn("Internal error while reading child nodes: " + e.getMessage(), e);
} finally {
- ownerDocument.getBrokerPool().release(broker);
+ if (broker != null)
+ broker.release();
}
return childList;
}
@@ -908,7 +919,8 @@ public Node getFirstChild() {
} catch (final EXistException e) {
LOG.warn("Exception while retrieving child node: " + e.getMessage(), e);
} finally {
- ownerDocument.getBrokerPool().release(broker);
+ if (broker != null)
+ broker.release();
}
return null;
}
@@ -981,7 +993,8 @@ public String getNodeValue() /*throws DOMException*/ {
} catch (final EXistException e) {
LOG.warn("Exception while reading node value: " + e.getMessage(), e);
} finally {
- ownerDocument.getBrokerPool().release(broker);
+ if (broker != null)
+ broker.release();
}
return "";
}
@@ -1180,8 +1193,13 @@ public Node insertBefore(Node newChild, Node refChild) throws DOMException {
transact.abort(transaction);
LOG.warn("Exception while inserting node: " + e.getMessage(), e);
} finally {
- transact.close(transaction);
- ownerDocument.getBrokerPool().release(broker);
+ if (broker != null) {
+ try {
+ transact.close(transaction);
+ } finally {
+ broker.release();
+ }
+ }
}
return null;
}
@@ -1233,7 +1251,8 @@ public void insertBefore(Txn transaction, NodeList nodes, Node refChild) throws
} catch (final EXistException e) {
LOG.warn("Exception while inserting node: " + e.getMessage(), e);
} finally {
- ownerDocument.getBrokerPool().release(broker);
+ if (broker != null)
+ broker.release();
}
}
@@ -1276,7 +1295,8 @@ public void insertAfter(Txn transaction, NodeList nodes, Node refChild) throws D
} catch (final EXistException e) {
LOG.warn("Exception while inserting node: " + e.getMessage(), e);
} finally {
- ownerDocument.getBrokerPool().release(broker);
+ if (broker != null)
+ broker.release();
}
}
@@ -1336,7 +1356,8 @@ public void update(Txn transaction, NodeList newContent) throws DOMException {
} catch (final EXistException e) {
LOG.warn("Exception while inserting node: " + e.getMessage(), e);
} finally {
- ownerDocument.getBrokerPool().release(broker);
+ if (broker != null)
+ broker.release();
}
}
@@ -1406,7 +1427,8 @@ public StoredNode updateChild(Txn transaction, Node oldChild, Node newChild) thr
} catch (final EXistException e) {
LOG.warn("Exception while inserting node: " + e.getMessage(), e);
} finally {
- ownerDocument.getBrokerPool().release(broker);
+ if (broker != null)
+ broker.release();
}
return newNode;
}
@@ -1449,7 +1471,8 @@ public Node removeChild(Txn transaction, Node oldChild) throws DOMException {
} catch (final EXistException e) {
LOG.warn("Exception while inserting node: " + e.getMessage(), e);
} finally {
- ownerDocument.getBrokerPool().release(broker);
+ if (broker != null)
+ broker.release();
}
return oldNode;
}
@@ -1504,14 +1527,15 @@ public void removeAppendAttributes(Txn transaction, NodeList removeList, NodeLis
setDirty(true);
}
attributes += appendList.getLength();
+
+ broker.updateNode(transaction, this, true);
+ broker.flush();
+
} catch (final EXistException e) {
LOG.warn("Exception while inserting node: " + e.getMessage(), e);
} finally {
- if (broker != null) {
- broker.updateNode(transaction, this, true);
- broker.flush();
- ownerDocument.getBrokerPool().release(broker);
- }
+ if (broker != null)
+ broker.release();
}
}
@@ -1586,7 +1610,8 @@ public Node replaceChild(Txn transaction, Node newChild, Node oldChild) throws D
} catch (final EXistException e) {
LOG.warn("Exception while inserting node: " + e.getMessage(), e);
} finally {
- ownerDocument.getBrokerPool().release(broker);
+ if (broker != null)
+ broker.release();
}
//return oldChild; // method is spec'd to return the old child, even though that's probably useless in this case
return newNode; //returning the newNode is more sensible than returning the oldNode
View
4 src/org/exist/storage/DBBroker.java
@@ -826,4 +826,8 @@ public abstract EmbeddedXMLStreamReader newXMLStreamReader(NodeHandle node, bool
public abstract void backupToArchive(RawDataBackup backup) throws IOException, EXistException;
public abstract void readCollectionEntry(SubCollectionEntry entry);
+
+ public void release() {
+ pool.release(this);
+ }
}

No commit comments for this range

Something went wrong with that request. Please try again.