/** * Creates a new {@link SailConnection}, using the given {@link SailStore} to manage the state. * * @param sail * @param store * @param evalStratFactory * the {@link EvaluationStrategyFactory} to use. */ protected SailSourceConnection(AbstractSail sail, SailStore store, EvaluationStrategyFactory evalStratFactory) { super(sail); this.vf = sail.getValueFactory(); this.store = store; this.defaultIsolationLevel = sail.getDefaultIsolationLevel(); this.evalStratFactory = evalStratFactory; this.federatedServiceResolver = (evalStratFactory instanceof StrictEvaluationStrategyFactory) ? ((StrictEvaluationStrategyFactory)evalStratFactory).getFederatedServiceResolver() : null; }
public AbstractSail() { super(); this.addSupportedIsolationLevel(IsolationLevels.READ_UNCOMMITTED); this.addSupportedIsolationLevel(IsolationLevels.SERIALIZABLE); }
@Override public SailConnection getConnection() throws SailException { initializationLock.readLock().lock(); try { if (!isInitialized()) { throw new IllegalStateException("Sail is not initialized or has been shut down"); } SailConnection connection = getConnectionInternal(); Throwable stackTrace = debugEnabled() ? new Throwable() : null; synchronized (activeConnections) { activeConnections.put(connection, stackTrace); } return connection; } finally { initializationLock.readLock().unlock(); } }
@Override public void initialize() throws SailException { initializationLock.writeLock().lock(); try { logger.trace("is initialized: {}", isInitialized()); if (isInitialized()) { throw new IllegalStateException( "Sail has already been intialized. Ensure this Sail is being used via a Repository."); } initializeInternal(); initialized = true; } finally { initializationLock.writeLock().unlock(); } }
level = this.sailBase.getDefaultIsolationLevel(); this.sailBase.getSupportedIsolationLevels()); if (compatibleLevel == null) { throw new UnknownSailTransactionStateException(
if (!isInitialized()) { return; shutDownInternal();
/** * The default implementation buffers added statements until the update operation is complete. */ @Override public void addStatement(UpdateContext op, Resource subj, IRI pred, Value obj, Resource... contexts) throws SailException { verifyIsOpen(); verifyIsActive(); synchronized (added) { assert added.containsKey(op); Collection<Statement> pending = added.get(op); if (contexts == null || contexts.length == 0) { pending.add(sailBase.getValueFactory().createStatement(subj, pred, obj)); } else { for (Resource ctx : contexts) { pending.add(sailBase.getValueFactory().createStatement(subj, pred, obj, ctx)); } } if (pending.size() % BLOCK_SIZE == 0 && !isActiveOperation()) { endUpdate(op); startUpdate(op); } } }
@Override public NotifyingSailConnection getConnection() throws SailException { return (NotifyingSailConnection)super.getConnection(); }
@Override public void setDataDir(File dataDir) { if (isInitialized()) { throw new IllegalStateException("sail has already been initialized"); } this.dataDir = dataDir; }
sailBase.connectionClosed(this);
level = this.sailBase.getDefaultIsolationLevel(); this.sailBase.getSupportedIsolationLevels()); if (compatibleLevel == null) { throw new UnknownSailTransactionStateException(
@Override public void initialize() throws SailException { initializationLock.writeLock().lock(); try { logger.trace("is initialized: {}", isInitialized()); if (isInitialized()) { throw new IllegalStateException( "Sail has already been intialized. Ensure this Sail is being used via a Repository."); } initializeInternal(); initialized = true; } finally { initializationLock.writeLock().unlock(); } }
if (!isInitialized()) { return; shutDownInternal();
/** * The default implementation buffers added statements until the update operation is complete. */ @Override public void addStatement(UpdateContext op, Resource subj, IRI pred, Value obj, Resource... contexts) throws SailException { verifyIsOpen(); verifyIsActive(); synchronized (added) { assert added.containsKey(op); Collection<Statement> pending = added.get(op); if (contexts == null || contexts.length == 0) { pending.add(sailBase.getValueFactory().createStatement(subj, pred, obj)); } else { for (Resource ctx : contexts) { pending.add(sailBase.getValueFactory().createStatement(subj, pred, obj, ctx)); } } if (pending.size() % BLOCK_SIZE == 0 && !isActiveOperation()) { endUpdate(op); startUpdate(op); } } }
@Override public NotifyingSailConnection getConnection() throws SailException { return (NotifyingSailConnection)super.getConnection(); }
@Override public void setDataDir(File dataDir) { if (isInitialized()) { throw new IllegalStateException("sail has already been initialized"); } this.dataDir = dataDir; }
@Override public SailConnection getConnection() throws SailException { initializationLock.readLock().lock(); try { if (!isInitialized()) { throw new IllegalStateException("Sail is not initialized or has been shut down"); } SailConnection connection = getConnectionInternal(); Throwable stackTrace = debugEnabled() ? new Throwable() : null; synchronized (activeConnections) { activeConnections.put(connection, stackTrace); } return connection; } finally { initializationLock.readLock().unlock(); } }
public AbstractSail() { super(); this.addSupportedIsolationLevel(IsolationLevels.READ_UNCOMMITTED); this.addSupportedIsolationLevel(IsolationLevels.SERIALIZABLE); }