コード例 #1
0
 public void setDeclarativeConfig(CacheConfig cacheConfig) {
   if (!this.pdxDiskStoreUserSet) {
     this.pdxDiskStore = cacheConfig.getPdxDiskStore();
     this.pdxDiskStoreUserSet = cacheConfig.pdxDiskStoreUserSet;
   }
   if (!this.pdxPersistentUserSet) {
     this.pdxPersistent = cacheConfig.isPdxPersistent();
     this.pdxPersistentUserSet = cacheConfig.pdxPersistentUserSet;
   }
   if (!this.pdxReadSerializedUserSet) {
     this.pdxReadSerialized = cacheConfig.isPdxReadSerialized();
     this.pdxReadSerializedUserSet = cacheConfig.pdxReadSerializedUserSet;
   }
   if (!this.pdxSerializerUserSet) {
     this.pdxSerializer = cacheConfig.getPdxSerializer();
     this.pdxSerializerUserSet = cacheConfig.pdxSerializerUserSet;
   }
   if (!this.pdxIgnoreUnreadFieldsUserSet) {
     this.pdxIgnoreUnreadFields = cacheConfig.getPdxIgnoreUnreadFields();
     this.pdxIgnoreUnreadFieldsUserSet = cacheConfig.pdxIgnoreUnreadFieldsUserSet;
   }
 }
コード例 #2
0
  private static synchronized Cache create(
      DistributedSystem system, boolean existingOk, CacheConfig cacheConfig)
      throws CacheExistsException, TimeoutException, CacheWriterException, GatewayException,
          RegionExistsException {
    GemFireCacheImpl instance = GemFireCacheImpl.getInstance();

    if (instance != null && !instance.isClosed()) {
      if (existingOk) {
        // Check if cache configuration matches.
        cacheConfig.validateCacheConfig(instance);

        return instance;
      } else {
        // instance.creationStack argument is for debugging...
        throw new CacheExistsException(
            instance,
            LocalizedStrings.CacheFactory_0_AN_OPEN_CACHE_ALREADY_EXISTS.toLocalizedString(
                instance),
            instance.creationStack);
      }
    }
    return GemFireCacheImpl.create(system, cacheConfig);
  }