24
24
*/
25
25
public class RecyclerPoolTest
26
26
{
27
- final static int THREAD_COUNT = 100 ;
27
+ final static int THREAD_COUNT = 200 ;
28
28
29
29
final static int RUNTIME_SECS = 60 ;
30
30
@@ -100,7 +100,8 @@ void testUntil(JsonFactory jsonF,
100
100
long endTimeMsecs , int threadId , AtomicLong calls )
101
101
{
102
102
final Random rnd = new Random (threadId );
103
- final byte [] JSON_INPUT = "\" abc\" " .getBytes (StandardCharsets .UTF_8 );
103
+ final byte [] JSON_INPUT = "42 "
104
+ .getBytes (StandardCharsets .UTF_8 );
104
105
105
106
while (System .currentTimeMillis () < endTimeMsecs ) {
106
107
try {
@@ -144,7 +145,6 @@ private void _testWrite(JsonFactory jsonF) throws Exception
144
145
StringWriter w = new StringWriter (16 );
145
146
JsonGenerator g = jsonF .createGenerator (w );
146
147
g .writeStartArray ();
147
- g .writeString ("foobar" );
148
148
g .writeEndArray ();
149
149
g .close ();
150
150
}
@@ -154,15 +154,15 @@ public static void main(String[] args) throws Exception
154
154
RecyclerPoolTest test = new RecyclerPoolTest (THREAD_COUNT );
155
155
List <String > results = Arrays .asList (
156
156
test .testPool (JsonFactory .builder ()
157
- .recyclerPool (JsonRecyclerPools .newConcurrentDequePool ())
157
+ .recyclerPool (JsonRecyclerPools .newLockFreePool ())
158
158
.build (),
159
- RUNTIME_SECS ),
159
+ RUNTIME_SECS * 1000 ),
160
160
test .testPool (JsonFactory .builder ()
161
- .recyclerPool (JsonRecyclerPools .newBoundedPool ( THREAD_COUNT - 5 ))
161
+ .recyclerPool (JsonRecyclerPools .newConcurrentDequePool ( ))
162
162
.build (),
163
163
RUNTIME_SECS ),
164
164
test .testPool (JsonFactory .builder ()
165
- .recyclerPool (JsonRecyclerPools .newLockFreePool ( ))
165
+ .recyclerPool (JsonRecyclerPools .newBoundedPool ( THREAD_COUNT - 5 ))
166
166
.build (),
167
167
RUNTIME_SECS )
168
168
);
0 commit comments