Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package com.facebook.presto.operator;
 
 
 import java.net.URI;
 import java.util.List;
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.base.Preconditions.checkState;
 
 public class ExchangeOperator
         implements SourceOperatorCloseable
 {
     public static class ExchangeOperatorFactory
             implements SourceOperatorFactory
     {
         private final int operatorId;
         private final PlanNodeId sourceId;
         private final Supplier<ExchangeClientexchangeClientSupplier;
         private final List<Typetypes;
         private boolean closed;
 
         public ExchangeOperatorFactory(int operatorIdPlanNodeId sourceIdSupplier<ExchangeClientexchangeClientSupplierList<Typetypes)
         {
             this. = operatorId;
             this. = sourceId;
             this. = exchangeClientSupplier;
             this. = types;
         }
 
         @Override
         public PlanNodeId getSourceId()
         {
             return ;
         }
 
         @Override
         public List<TypegetTypes()
         {
             return ;
         }
 
         @Override
         public SourceOperator createOperator(DriverContext driverContext)
         {
             checkState(!"Factory is already closed");
 
             OperatorContext operatorContext = driverContext.addOperatorContext(ExchangeOperator.class.getSimpleName());
             return new ExchangeOperator(
                     operatorContext,
                     ,
                     ,
                     .get());
         }
 
         @Override
         public void close()
         {
              = true;
         }
     }
 
     private final OperatorContext operatorContext;
     private final PlanNodeId sourceId;
     private final ExchangeClient exchangeClient;
     private final List<Typetypes;
 
     public ExchangeOperator(
             OperatorContext operatorContext,
             List<Typetypes,
             PlanNodeId sourceId,
             final ExchangeClient exchangeClient)
     {
         this. = checkNotNull(operatorContext"operatorContext is null");
         this. = checkNotNull(sourceId"sourceId is null");
         this. = checkNotNull(exchangeClient"exchangeClient is null");
         this. = checkNotNull(types"types is null");
 
        operatorContext.setInfoSupplier(new Supplier<Object>()
        {
            @Override
            public Object get()
            {
                return exchangeClient.getStatus();
            }
        });
    }
    @Override
    public PlanNodeId getSourceId()
    {
        return ;
    }
    @Override
    public void addSplit(Split split)
    {
        checkNotNull(split"split is null");
        checkArgument(split.getConnectorId().equals("remote"), "split is not a remote split");
        URI location = ((RemoteSplitsplit.getConnectorSplit()).getLocation();
        .addLocation(location);
    }
    @Override
    public void noMoreSplits()
    {
    }
    @Override
    {
        return ;
    }
    @Override
    public List<TypegetTypes()
    {
        return ;
    }
    @Override
    public void finish()
    {
        close();
    }
    @Override
    public boolean isFinished()
    {
        return .isClosed();
    }
    @Override
    public ListenableFuture<?> isBlocked()
    {
        ListenableFuture<?> blocked = .isBlocked();
        if (blocked.isDone()) {
            return ;
        }
        return blocked;
    }
    @Override
    public boolean needsInput()
    {
        return false;
    }
    @Override
    public void addInput(Page page)
    {
        throw new UnsupportedOperationException(getClass().getName() + " can not take input");
    }
    @Override
    public Page getOutput()
    {
        Page page = .pollPage();
        if (page != null) {
        }
        return page;
    }
    @Override
    public void close()
    {
        .close();
    }
New to GrepCode? Check out our FAQ X