当前位置: 首页>>代码示例>>Java>>正文


Java Transaction.AUTO_COMMIT属性代码示例

本文整理汇总了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);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:20,代码来源:AbstractLockingManagement.java

示例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"));
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:24,代码来源:MemoryLockManagerTest.java

示例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;
	}
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:35,代码来源:GeoWaveGTDataStore.java

示例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;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:14,代码来源:AbstractLockingManagement.java

示例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;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:14,代码来源:AbstractLockingManagement.java

示例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();
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:29,代码来源:MemoryLockManagerTest.java

示例7: getFeatureReader

public FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader() throws IOException {
    return super.getFeatureReader(new Query(getTypeName().getLocalPart()),
            Transaction.AUTO_COMMIT);
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:4,代码来源:ShapefileDataStore.java

示例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;
		}
	}
 
开发者ID:dainst,项目名称:gazetteer,代码行数:43,代码来源:ShapefileCreator.java


注:本文中的org.geotools.data.Transaction.AUTO_COMMIT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。