applies concurrency fixes

This commit is contained in:
eyck committed 2026-11-20 22:31:48 +01:00
1 parent 42e0d83403
commit 28eb1b673e
56 files changed
+1462 -372

No files matched your search

@@ -132,7 +132,9 @@ abstract class AbstractTxStream extends HierNode implements IWaveform, ITransact
public RelationType getRelationType(String name) {
RelationType relType=RelationTypeFactory.create(name);
if(!usedRelationsList.contains(relType)) usedRelationsList.add(relType);
synchronized (usedRelationsList) {
if (!usedRelationsList.contains(relType)) usedRelationsList.add(relType);
}
return relType;
}
@@ -106,37 +106,39 @@ public class Tx implements ITx {
}
@Override
public Collection<ITxRelation> getIncomingRelations() {
public synchronized Collection<ITxRelation> getIncomingRelations() {
if(incoming==null){
SQLiteDatabaseSelectHandler<ScvTxRelation> handler = new SQLiteDatabaseSelectHandler<>(
ScvTxRelation.class, database, "sink="+scvTx.getId());
try {
incoming = new ArrayList<>();
for(ScvTxRelation scvRelation:handler.selectObjects()){
incoming.add(createRelation(scvRelation, false));
ITxRelation relation = createRelation(scvRelation, false);
if (relation != null) incoming.add(relation);
}
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
| InvocationTargetException | SQLException | IntrospectionException | NoSuchMethodException e) {
}
}
return incoming;
return List.copyOf(incoming);
}
@Override
public Collection<ITxRelation> getOutgoingRelations() {
public synchronized Collection<ITxRelation> getOutgoingRelations() {
if(outgoing==null){
SQLiteDatabaseSelectHandler<ScvTxRelation> handler = new SQLiteDatabaseSelectHandler<>(
ScvTxRelation.class, database, "src="+scvTx.getId());
try {
outgoing = new ArrayList<>();
for(ScvTxRelation scvRelation:handler.selectObjects()){
outgoing.add(createRelation(scvRelation, true));
ITxRelation relation = createRelation(scvRelation, true);
if (relation != null) outgoing.add(relation);
}
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
| InvocationTargetException | SQLException | IntrospectionException | NoSuchMethodException e) {
}
}
return outgoing;
return List.copyOf(outgoing);
}
private ITxRelation createRelation(ScvTxRelation rel, boolean outgoing) {