Skip to content

Commit

Permalink
HSEARCH-2178 Have BackendRequestProcessor release requested services
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanne committed May 16, 2016
1 parent 8af4645 commit b3a03f0
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -20,6 +20,7 @@
import org.hibernate.search.backend.elasticsearch.logging.impl.Log;
import org.hibernate.search.backend.impl.lucene.MultiWriteDrainableLinkedList;
import org.hibernate.search.engine.service.spi.Service;
import org.hibernate.search.engine.service.spi.ServiceManager;
import org.hibernate.search.engine.service.spi.Startable;
import org.hibernate.search.engine.service.spi.Stoppable;
import org.hibernate.search.exception.ErrorHandler;
Expand Down Expand Up @@ -50,6 +51,7 @@ public class BackendRequestProcessor implements Service, Startable, Stoppable {

private final AsyncBackendRequestProcessor asyncProcessor;
private ErrorHandler errorHandler;
private ServiceManager serviceManager;
private JestClient jestClient;

public BackendRequestProcessor() {
Expand All @@ -59,12 +61,14 @@ public BackendRequestProcessor() {
@Override
public void start(Properties properties, BuildContext context) {
this.errorHandler = context.getErrorHandler();
this.jestClient = context.getServiceManager().requestService( JestClient.class );
this.serviceManager = context.getServiceManager();
this.jestClient = serviceManager.requestService( JestClient.class );
}

@Override
public void stop() {
awaitAsyncProcessingCompletion();
serviceManager.releaseService( JestClient.class );
}

public void executeSync(Iterable<BackendRequest<?>> requests) {
Expand Down

0 comments on commit b3a03f0

Please sign in to comment.