本文整理汇总了Java中org.geotools.data.Transaction.AUTO_COMMIT属性的典型用法代码示例。如果您正苦于以下问题:Java Transaction.AUTO_COMMIT属性的具体用法?Java Transaction.AUTO_COMMIT怎么用?Java Transaction.AUTO_COMMIT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.geotools.data.Transaction
的用法示例。
在下文中一共展示了Transaction.AUTO_COMMIT属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unlock
private void unlock(
Transaction transaction,
String featureID,
Set<String> authorizations,
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);
}
示例2: testReset
@Test
public void testReset()
throws InterruptedException,
IOException {
final LockingManagement memoryLockManager = new MemoryLockManager(
"default");
final Transaction t1 = Transaction.AUTO_COMMIT;
FeatureLock lock = new FeatureLock(
"auth2",
1 /* minute */);
memoryLockManager.lockFeatureID(
"sometime",
"f2",
t1,
lock);
memoryLockManager.refresh(
"auth2",
t1);
assertTrue(memoryLockManager.exists("auth2"));
memoryLockManager.release(
"auth2",
t1);
assertFalse(memoryLockManager.exists("auth2"));
}
示例3: getMyTransactionState
/**
* 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;
}
}
示例4: release
@Override
public boolean release(
String authID,
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;
}
示例5: refresh
@Override
public boolean refresh(
String authID,
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;
}
示例6: testLockReleaseOfBulkAuthLock
@Test
public void testLockReleaseOfBulkAuthLock()
throws InterruptedException,
IOException {
final LockingManagement memoryLockManager = new MemoryLockManager(
"default");
final Transaction t1 = Transaction.AUTO_COMMIT;
final DefaultTransaction t2 = new DefaultTransaction();
t2.addAuthorization("auth1");
FeatureLock lock = new FeatureLock(
"auth1",
1 /* minute */);
memoryLockManager.lockFeatureID(
"sometime",
"f4",
t1,
lock);
memoryLockManager.lock(
t2,
"f4");
t2.commit();
// commit should not take away the lock
assertTrue(memoryLockManager.exists("auth1"));
memoryLockManager.release(
"auth1",
t1);
assertFalse(memoryLockManager.exists("auth1"));
t1.close();
}
示例7: getFeatureReader
public FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader() throws IOException {
return super.getFeatureReader(new Query(getTypeName().getLocalPart()),
Transaction.AUTO_COMMIT);
}
示例8: createMemoryDataStore
private MemoryDataStore createMemoryDataStore(List<String> placeIds, GeometryType geometryType) throws Exception {
SimpleFeatureType featureType = createFeatureType(geometryType);
MemoryDataStore memoryDataStore = new MemoryDataStore();
memoryDataStore.createSchema(featureType);
GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
PlaceAccessService placeAccessService = new PlaceAccessService(recordGroupRepository, groupRoleRepository);
Transaction transaction = Transaction.AUTO_COMMIT;
boolean dataStoreEmpty = true;
for (String placeId : placeIds) {
Place place = getPlace(placeId, placeAccessService);
if (containsGeometryOfFeatureType(place.getPrefLocation(), geometryType)) {
if (addFeature(place, place.getPrefLocation(), "preferred location", featureType, geometryType, geometryFactory, memoryDataStore, transaction)) {
dataStoreEmpty = false;
}
}
for (Location location : place.getLocations()) {
if (containsGeometryOfFeatureType(location, geometryType)) {
if (addFeature(place, location, "alternative location", featureType, geometryType, geometryFactory, memoryDataStore, transaction)) {
dataStoreEmpty = false;
}
}
}
}
transaction.close();
transaction = null;
if (!dataStoreEmpty) {
return memoryDataStore;
} else {
return null;
}
}