Skip to content

Commit

Permalink
Small cleanup in RunnableBoltWorker
Browse files Browse the repository at this point in the history
  • Loading branch information
lutovich committed Jan 24, 2017
1 parent 3a91140 commit 721e3cc
Showing 1 changed file with 7 additions and 3 deletions.
Expand Up @@ -20,7 +20,9 @@
package org.neo4j.bolt.v1.runtime.concurrent;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;

import org.neo4j.bolt.v1.runtime.BoltConnectionAuthFatality;
Expand All @@ -39,7 +41,7 @@ class RunnableBoltWorker implements Runnable, BoltWorker
{
private static final int workQueueSize = Integer.getInteger( "org.neo4j.bolt.workQueueSize", 100 );

private final ArrayBlockingQueue<Job> jobQueue = new ArrayBlockingQueue<>( workQueueSize );
private final BlockingQueue<Job> jobQueue = new ArrayBlockingQueue<>( workQueueSize );
private final BoltStateMachine machine;
private final Log log;
private final Log userLog;
Expand All @@ -58,6 +60,7 @@ class RunnableBoltWorker implements Runnable, BoltWorker
* possible.
* @param job an operation to be performed on the session
*/
@Override
public void enqueue( Job job )
{
try
Expand All @@ -66,6 +69,7 @@ public void enqueue( Job job )
}
catch ( InterruptedException e )
{
Thread.currentThread().interrupt();
throw new RuntimeException( "Worker interrupted while queueing request, the session may have been " +
"forcibly closed, or the database may be shutting down." );
}
Expand All @@ -74,7 +78,7 @@ public void enqueue( Job job )
@Override
public void run()
{
ArrayList<Job> batch = new ArrayList<>( workQueueSize );
List<Job> batch = new ArrayList<>( workQueueSize );

try
{
Expand Down Expand Up @@ -111,7 +115,7 @@ public void run()
}
}

private void executeBatch( ArrayList<Job> batch ) throws BoltConnectionFatality
private void executeBatch( List<Job> batch ) throws BoltConnectionFatality
{
for ( int i = 0; keepRunning && i < batch.size(); i++ )
{
Expand Down

0 comments on commit 721e3cc

Please sign in to comment.