diff --git a/impl/src/main/java/uk/ac/manchester/cs/owl/owlapi/concurrent/ConcurrentOWLOntologyImpl.java b/impl/src/main/java/uk/ac/manchester/cs/owl/owlapi/concurrent/ConcurrentOWLOntologyImpl.java index ade28aafdc..32880fe9fa 100644 --- a/impl/src/main/java/uk/ac/manchester/cs/owl/owlapi/concurrent/ConcurrentOWLOntologyImpl.java +++ b/impl/src/main/java/uk/ac/manchester/cs/owl/owlapi/concurrent/ConcurrentOWLOntologyImpl.java @@ -25,11 +25,12 @@ import org.semanticweb.owlapi.model.parameters.Imports; import org.semanticweb.owlapi.model.parameters.Navigation; import org.semanticweb.owlapi.util.OWLAxiomSearchFilter; +import uk.ac.manchester.cs.owl.owlapi.HasTrimToSize; /** * Matthew Horridge Stanford Center for Biomedical Informatics Research 03/04/15 */ -public class ConcurrentOWLOntologyImpl implements OWLMutableOntology { +public class ConcurrentOWLOntologyImpl implements OWLMutableOntology,HasTrimToSize { private final OWLOntology delegate; private final ReadWriteLock readWriteLock; @@ -50,6 +51,20 @@ public ConcurrentOWLOntologyImpl(@Nonnull OWLOntology delegate, @Nonnull ReadWri this.writeLock = verifyNotNull(readWriteLock).writeLock(); } + @Override + public void trimToSize() { + writeLock.lock(); + try { + if (delegate instanceof HasTrimToSize) { + HasTrimToSize trimmableDelegate = (HasTrimToSize) delegate; + trimmableDelegate.trimToSize(); + } + } finally { + writeLock.unlock(); + } + + } + @Override public void accept(@Nonnull OWLNamedObjectVisitor owlNamedObjectVisitor) { delegate.accept(owlNamedObjectVisitor);