예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void reusableTypeConfiguration()
        public virtual void ReusableTypeConfiguration()
        {
            IdTypeConfigurationProvider provider          = CreateIdTypeProvider();
            IdTypeConfiguration         typeConfiguration = provider.GetIdTypeConfiguration(_reusableType);

            assertTrue(typeConfiguration.AllowAggressiveReuse());
            assertEquals(50000, typeConfiguration.GrabSize);
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void nonReusableTypeConfiguration()
        public virtual void NonReusableTypeConfiguration()
        {
            IdTypeConfigurationProvider provider          = CreateIdTypeProvider();
            IdTypeConfiguration         typeConfiguration = provider.GetIdTypeConfiguration(IdType.SCHEMA);

            assertFalse("Schema record ids are not reusable.", typeConfiguration.AllowAggressiveReuse());
            assertEquals("Schema record ids are not reusable.", 1024, typeConfiguration.GrabSize);
        }
        public override IdGenerator Open(File filename, int grabSize, IdType idType, System.Func <long> highId, long maxId)
        {
            Debug.Assert(_boundaries != null, "Factory needs to be initialized before usage");

            IdGenerator         generator         = @delegate.Open(filename, grabSize, idType, highId, maxId);
            IdTypeConfiguration typeConfiguration = GetIdTypeConfiguration(idType);

            if (typeConfiguration.AllowAggressiveReuse())
            {
                BufferingIdGenerator bufferingGenerator = new BufferingIdGenerator(generator);
                bufferingGenerator.Initialize(_boundaries, _safeThreshold);
                _overriddenIdGenerators[( int )idType] = bufferingGenerator;
                generator = bufferingGenerator;
            }
            return(generator);
        }
예제 #4
0
        public override IdGenerator Open(File fileName, int grabSize, IdType idType, System.Func <long> highId, long maxId)
        {
            IdTypeConfiguration idTypeConfiguration = _idTypeConfigurationProvider.getIdTypeConfiguration(idType);
            IdGenerator         generator           = Instantiate(_fs, fileName, grabSize, maxId, idTypeConfiguration.AllowAggressiveReuse(), idType, highId);

            _generators[idType] = generator;
            return(generator);
        }
예제 #5
0
        public override IdGenerator Open(File fileName, int grabSize, IdType idType, System.Func <long> highId, long maxId)
        {
            IdTypeConfiguration idTypeConfiguration = _idTypeConfigurationProvider.getIdTypeConfiguration(idType);

            return(OpenGenerator(fileName, grabSize, idType, highId, maxId, idTypeConfiguration.AllowAggressiveReuse()));
        }
예제 #6
0
 public EphemeralIdGenerator(IdType idType, IdTypeConfiguration idTypeConfiguration)
 {
     this._idType   = idType;
     this._freeList = idType != null && idTypeConfiguration.AllowAggressiveReuse() ? new ConcurrentLinkedQueue <long>() : null;
 }