Java Code Examples for org.geotools.data.Transaction#getState()

The following examples show how to use org.geotools.data.Transaction#getState() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeoWaveGTDataStore.java    From geowave with Apache License 2.0 6 votes vote down vote up
/**
 * Used to retrieve the TransactionStateDiff for this transaction.
 *
 * <p>
 *
 * @param transaction
 * @return GeoWaveTransactionState or null if subclass is handling differences
 * @throws IOException
 */
protected GeoWaveTransactionState getMyTransactionState(
    final Transaction transaction,
    final GeoWaveFeatureSource source) throws IOException {
  synchronized (transaction) {
    GeoWaveTransactionState state = null;
    if (transaction == Transaction.AUTO_COMMIT) {
      state = new GeoWaveAutoCommitTransactionState(source);
    } else {
      state = (GeoWaveTransactionState) transaction.getState(this);
      if (state == null) {
        state =
            new GeoWaveTransactionManagementState(
                transactionBufferSize,
                source.getComponents(),
                transaction,
                (LockingManagement) lockingManager);
        transaction.putState(this, state);
      }
    }
    return state;
  }
}
 
Example 2
Source File: AbstractLockingManagement.java    From geowave with Apache License 2.0 5 votes vote down vote up
private void unlock(
    final Transaction transaction,
    final String featureID,
    final Set<String> authorizations,
    final long expiryInMinutes) {
  AuthorizedLock lock =
      transaction == Transaction.AUTO_COMMIT ? null : (AuthorizedLock) transaction.getState(this);
  if (lock == null) {
    lock = new AuthorizedLock(this, authorizations, expiryInMinutes);
    if (transaction != Transaction.AUTO_COMMIT) {
      transaction.putState(this, lock);
    }
  }
  unlock(lock, featureID);
}
 
Example 3
Source File: AbstractLockingManagement.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
public boolean release(final String authID, final Transaction transaction) throws IOException {
  AuthorizedLock lock =
      transaction == Transaction.AUTO_COMMIT ? null : (AuthorizedLock) transaction.getState(this);
  if (lock == null) {
    lock = new AuthorizedLock(this, authID, 1 /* minutes */);
  }
  releaseAll(lock);
  return true;
}
 
Example 4
Source File: AbstractLockingManagement.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
public boolean refresh(final String authID, final Transaction transaction) throws IOException {
  AuthorizedLock lock =
      transaction == Transaction.AUTO_COMMIT ? null : (AuthorizedLock) transaction.getState(this);
  if (lock == null) {
    lock = new AuthorizedLock(this, authID, 1 /* minutes */);
  }
  resetAll(lock);
  return true;
}