rdf4j
rdf4j copied to clipboard
Isolation level is always null, if queried from the RepositoryConnection
Discussed in https://github.com/eclipse-rdf4j/rdf4j/discussions/4798
Originally posted by domkun October 6, 2023 Hi there,
I had a problem with concurrent transactions, so I wanted to log the isolation level of the current connection using RepositoryConnection#getIsolationLevel method. However it always returns null. The underlying sailConnection property of the SailRepositoryConnection shows the set isolation level. Is this intended?
I am a bit confused about this. Here is a short reproducer:
import org.eclipse.rdf4j.common.transaction.IsolationLevels;
import org.eclipse.rdf4j.repository.Repository;
import org.eclipse.rdf4j.repository.RepositoryConnection;
import org.eclipse.rdf4j.repository.sail.SailRepository;
import org.eclipse.rdf4j.sail.memory.MemoryStore;
class Scratch {
public static void main(String[] args) {
Repository sailRepository = new SailRepository(new MemoryStore());
try (RepositoryConnection connection = sailRepository.getConnection()) {
connection.begin(IsolationLevels.SERIALIZABLE);
System.out.println(connection.getIsolationLevel());
connection.commit();
}
}
}
Edit: Screenshot of the debugger window attached
I had alook at it, I am not sure if this is all that is needed to fix it, I am pretty new to the RDF4J world.