@Test public void testByteBufStringValuePool() { final int capacity = 8; final int chars = Integer.toString(capacity).length(); final TypedProperties.StringValue.ByteBufStringValuePool pool = new TypedProperties.StringValue.ByteBufStringValuePool(capacity, chars); final int bytes = new SimpleString(Integer.toString(capacity)).sizeof(); final ByteBuf bb = Unpooled.buffer(bytes, bytes); for (int i = 0; i < capacity; i++) { final SimpleString s = new SimpleString(Integer.toString(i)); bb.resetWriterIndex(); SimpleString.writeSimpleString(bb, s); bb.resetReaderIndex(); final TypedProperties.StringValue expectedPooled = pool.getOrCreate(bb); bb.resetReaderIndex(); Assert.assertSame(expectedPooled, pool.getOrCreate(bb)); bb.resetReaderIndex(); } }
public TypedPropertiesDecoderPools(int keyPoolCapacity, int valuePoolCapacity, int maxCharsLength) { this.propertyKeysPool = new SimpleString.ByteBufSimpleStringPool(keyPoolCapacity, maxCharsLength); this.propertyValuesPool = new TypedProperties.StringValue.ByteBufStringValuePool(valuePoolCapacity, maxCharsLength); }
public TypedPropertiesDecoderPools() { this.propertyKeysPool = new SimpleString.ByteBufSimpleStringPool(); this.propertyValuesPool = new TypedProperties.StringValue.ByteBufStringValuePool(); }
public TypedPropertiesDecoderPools(int keyPoolCapacity, int valuePoolCapacity, int maxCharsLength) { this.propertyKeysPool = new SimpleString.ByteBufSimpleStringPool(keyPoolCapacity, maxCharsLength); this.propertyValuesPool = new TypedProperties.StringValue.ByteBufStringValuePool(valuePoolCapacity, maxCharsLength); }
public TypedPropertiesDecoderPools(int keyPoolCapacity, int valuePoolCapacity, int maxCharsLength) { this.propertyKeysPool = new SimpleString.ByteBufSimpleStringPool(keyPoolCapacity, maxCharsLength); this.propertyValuesPool = new TypedProperties.StringValue.ByteBufStringValuePool(valuePoolCapacity, maxCharsLength); }
public TypedPropertiesDecoderPools() { this.propertyKeysPool = new SimpleString.ByteBufSimpleStringPool(); this.propertyValuesPool = new TypedProperties.StringValue.ByteBufStringValuePool(); }
public TypedPropertiesDecoderPools(int keyPoolCapacity, int valuePoolCapacity, int maxCharsLength) { this.propertyKeysPool = new SimpleString.ByteBufSimpleStringPool(keyPoolCapacity, maxCharsLength); this.propertyValuesPool = new TypedProperties.StringValue.ByteBufStringValuePool(valuePoolCapacity, maxCharsLength); }
public TypedPropertiesDecoderPools(int keyPoolCapacity, int valuePoolCapacity, int maxCharsLength) { this.propertyKeysPool = new SimpleString.ByteBufSimpleStringPool(keyPoolCapacity, maxCharsLength); this.propertyValuesPool = new TypedProperties.StringValue.ByteBufStringValuePool(valuePoolCapacity, maxCharsLength); }
public TypedPropertiesDecoderPools() { this.propertyKeysPool = new SimpleString.ByteBufSimpleStringPool(); this.propertyValuesPool = new TypedProperties.StringValue.ByteBufStringValuePool(); }
public TypedPropertiesDecoderPools() { this.propertyKeysPool = new SimpleString.ByteBufSimpleStringPool(); this.propertyValuesPool = new TypedProperties.StringValue.ByteBufStringValuePool(); }
static StringValue readStringValue(final ByteBuf byteBuf, ByteBufStringValuePool pool) { if (pool == null) { return new StringValue(SimpleString.readSimpleString(byteBuf)); } else { return pool.getOrCreate(byteBuf); } }
public TypedPropertiesDecoderPools() { this.propertyKeysPool = new SimpleString.ByteBufSimpleStringPool(); this.propertyValuesPool = new TypedProperties.StringValue.ByteBufStringValuePool(); }
public TypedPropertiesDecoderPools() { this.propertyKeysPool = new SimpleString.ByteBufSimpleStringPool(); this.propertyValuesPool = new TypedProperties.StringValue.ByteBufStringValuePool(); }
static StringValue readStringValue(final ByteBuf byteBuf, ByteBufStringValuePool pool) { if (pool == null) { return new StringValue(SimpleString.readSimpleString(byteBuf)); } else { return pool.getOrCreate(byteBuf); } }
static StringValue readStringValue(final ByteBuf byteBuf, ByteBufStringValuePool pool) { if (pool == null) { return new StringValue(SimpleString.readSimpleString(byteBuf)); } else { return pool.getOrCreate(byteBuf); } }
static StringValue readStringValue(final ByteBuf byteBuf, ByteBufStringValuePool pool) { if (pool == null) { return new StringValue(SimpleString.readSimpleString(byteBuf)); } else { return pool.getOrCreate(byteBuf); } }
@Test public void testByteBufStringValuePoolTooLong() { final SimpleString tooLong = new SimpleString("aa"); final ByteBuf bb = Unpooled.buffer(tooLong.sizeof(), tooLong.sizeof()); SimpleString.writeSimpleString(bb, tooLong); final TypedProperties.StringValue.ByteBufStringValuePool pool = new TypedProperties.StringValue.ByteBufStringValuePool(1, tooLong.length() - 1); Assert.assertNotSame(pool.getOrCreate(bb), pool.getOrCreate(bb.resetReaderIndex())); }
public TypedPropertiesDecoderPools(int keyPoolCapacity, int valuePoolCapacity, int maxCharsLength) { this.propertyKeysPool = new SimpleString.ByteBufSimpleStringPool(keyPoolCapacity, maxCharsLength); this.propertyValuesPool = new TypedProperties.StringValue.ByteBufStringValuePool(valuePoolCapacity, maxCharsLength); }
static StringValue readStringValue(final ByteBuf byteBuf, ByteBufStringValuePool pool) { if (pool == null) { return new StringValue(SimpleString.readSimpleString(byteBuf)); } else { return pool.getOrCreate(byteBuf); } }
static StringValue readStringValue(final ByteBuf byteBuf, ByteBufStringValuePool pool) { if (pool == null) { return new StringValue(SimpleString.readSimpleString(byteBuf)); } else { return pool.getOrCreate(byteBuf); } }