Java Code Examples for io.netty.util.internal.SystemPropertyUtil#getInt()

The following examples show how to use io.netty.util.internal.SystemPropertyUtil#getInt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecycleTest.java    From sailfish with Apache License 2.0 6 votes vote down vote up
@Test
public void testRecycleInSyncThread() throws Exception{
	//recycle
	Resource2 resource1 = Resource2.newInstance();
	resource1.recycle();
	
	//don't recycle
	resource1 = Resource2.newInstance();
	
	Resource2 temp =null;
	// By default we allow one push to a Recycler for each 8th try on handles that were never recycled before.
       // This should help to slowly increase the capacity of the recycler while not be too sensitive to allocation
       // bursts.
	int stackDefaultRatioMask = SystemPropertyUtil.getInt("io.netty.recycler.ratio", 8) - 1;
	for(int i =0; i< stackDefaultRatioMask; i++){
		temp = Resource2.newInstance();
		temp.recycle();
		Assert.assertTrue(temp != Resource2.newInstance());
	}
	
	temp = Resource2.newInstance();
	temp.recycle();
	Assert.assertTrue(temp == Resource2.newInstance());
}
 
Example 2
Source File: AbstractMicrobenchmark.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
protected int getForks() {
    return SystemPropertyUtil.getInt("forks", -1);
}
 
Example 3
Source File: AbstractMicrobenchmarkBase.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
protected int getWarmupIterations() {
    return SystemPropertyUtil.getInt("warmupIterations", -1);
}
 
Example 4
Source File: AbstractMicrobenchmarkBase.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
protected int getMeasureIterations() {
    return SystemPropertyUtil.getInt("measureIterations", -1);
}
 
Example 5
Source File: AbstractMicrobenchmark.java    From netty4.0.27Learn with Apache License 2.0 4 votes vote down vote up
protected int getWarmupIterations() {
    return SystemPropertyUtil.getInt("warmupIterations", -1);
}
 
Example 6
Source File: AbstractMicrobenchmark.java    From netty4.0.27Learn with Apache License 2.0 4 votes vote down vote up
protected int getMeasureIterations() {
    return SystemPropertyUtil.getInt("measureIterations", -1);
}
 
Example 7
Source File: AbstractMicrobenchmark.java    From netty4.0.27Learn with Apache License 2.0 4 votes vote down vote up
protected int getForks() {
    return SystemPropertyUtil.getInt("forks", -1);
}
 
Example 8
Source File: NettyByteBufLeakHelper.java    From ambry with Apache License 2.0 4 votes vote down vote up
/**
 * Constructor to create a {@link NettyByteBufLeakHelper}.
 */
public NettyByteBufLeakHelper() {
  // The allocator cache is enabled by default if this property is not set. The default value of 32k comes from
  // PooledByteBufAllocator.DEFAULT_MAX_CACHED_BUFFER_CAPACITY (private constant)
  cachedEnabled = SystemPropertyUtil.getInt("io.netty.allocator.maxCachedBufferCapacity", 32 * 1024) != 0;
}