Package org.jboss.dna.graph.request

Examples of org.jboss.dna.graph.request.CompositeRequestChannel$LastRequest


        CheckArg.isNotNull(connectionFactory, "connectionFactory");
        this.context = context;
        this.searchEngine = searchEngine;
        this.sourceName = searchEngine.getSourceName();
        this.connectionFactory = connectionFactory;
        this.channel = new CompositeRequestChannel(this.sourceName);
        this.service = Executors.newSingleThreadExecutor(new NamedThreadFactory("search-" + sourceName));
        // Start the channel and search engine processor right away (this is why this object must be closed)
        this.channel.start(service, this.context, this.connectionFactory);
        this.processor = this.searchEngine.createProcessor(this.context, null, false);
    }
View Full Code Here


                } finally {
                    searchProcessor.close();
                }
            } else if (request instanceof CompositeRequest) {
                CompositeRequest composite = (CompositeRequest)request;
                CompositeRequestChannel channel = null;
                RequestProcessor searchProcessor = null;
                try {
                    for (Request nested : composite) {
                        if (nested instanceof AccessQueryRequest) {
                            AccessQueryRequest queryRequest = (AccessQueryRequest)request;
                            if (searchProcessor == null) searchProcessor = searchEngine().createProcessor(context, null, true);
                            searchProcessor.process(queryRequest);
                        } else if (nested instanceof FullTextSearchRequest) {
                            FullTextSearchRequest searchRequest = (FullTextSearchRequest)request;
                            if (searchProcessor == null) searchProcessor = searchEngine().createProcessor(context, null, true);
                            searchProcessor.process(searchRequest);
                        } else {
                            // Delegate to the channel ...
                            if (channel == null) {
                                // Create a connection factory that always returns the delegate connection ...
                                RepositoryConnectionFactory connectionFactory = new RepositoryConnectionFactory() {
                                    /**
                                     * {@inheritDoc}
                                     *
                                     * @see org.jboss.dna.graph.connector.RepositoryConnectionFactory#createConnection(java.lang.String)
                                     */
                                    public RepositoryConnection createConnection( String sourceName )
                                        throws RepositorySourceException {
                                        assert delegate().getName().equals(sourceName);
                                        return delegateConnection();
                                    }
                                };
                                channel = new CompositeRequestChannel(delegate().getName());
                                channel.start(executorService, context, connectionFactory);
                            }
                            channel.add(request);
                        }
                    }
                } finally {
                    try {
                        if (searchProcessor != null) {
                            searchProcessor.close();
                        }
                    } finally {
                        if (channel != null) {
                            try {
                                channel.close();
                            } finally {
                                try {
                                    channel.await();
                                } catch (CancellationException err) {
                                    composite.cancel();
                                } catch (ExecutionException err) {
                                    composite.setError(err);
                                } catch (InterruptedException err) {
View Full Code Here

     * @see #submit(Request, String, CountDownLatch)
     */
    protected void submitAndAwait( Request request,
                                   String sourceName ) throws InterruptedException {
        assert request != null;
        CompositeRequestChannel channel = channelBySourceName.get(sourceName);
        if (channel == null) {
            channel = new CompositeRequestChannel(sourceName);
            channelBySourceName.put(sourceName, channel);
            channel.start(executor, getExecutionContext(), connectionFactory);
        }
        channel.addAndAwait(request);
    }
View Full Code Here

     */
    protected void submit( Request request,
                           String sourceName,
                           CountDownLatch latch ) {
        assert request != null;
        CompositeRequestChannel channel = channelBySourceName.get(sourceName);
        if (channel == null) {
            channel = new CompositeRequestChannel(sourceName);
            channelBySourceName.put(sourceName, channel);
            channel.start(executor, getExecutionContext(), connectionFactory);
        }
        channel.add(request, latch);
    }
View Full Code Here

     * @see #submit(Request, String, CountDownLatch)
     */
    protected void submit( Request request,
                           String sourceName ) {
        assert request != null;
        CompositeRequestChannel channel = channelBySourceName.get(sourceName);
        if (channel == null) {
            channel = new CompositeRequestChannel(sourceName);
            channelBySourceName.put(sourceName, channel);
            channel.start(executor, getExecutionContext(), connectionFactory);
        }
        channel.add(request);
    }
View Full Code Here

TOP

Related Classes of org.jboss.dna.graph.request.CompositeRequestChannel$LastRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.