apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vrozov <...@git.apache.org>
Subject [GitHub] incubator-apex-core pull request: APEX-254 & APEX-269
Date Tue, 24 Nov 2015 20:47:47 GMT
Github user vrozov commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-core/pull/173#discussion_r45792451
  
    --- Diff: engine/src/main/java/com/datatorrent/stram/engine/AbstractReservoir.java ---
    @@ -0,0 +1,786 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you 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.datatorrent.stram.engine;
    +
    +import java.lang.reflect.Constructor;
    +import java.util.Collection;
    +import java.util.Iterator;
    +import java.util.concurrent.ArrayBlockingQueue;
    +import java.util.concurrent.BlockingQueue;
    +import java.util.concurrent.TimeUnit;
    +
    +import org.jctools.queues.MessagePassingQueue;
    +import org.jctools.queues.SpscArrayQueue;
    +
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import com.datatorrent.api.Sink;
    +import com.datatorrent.netlet.util.CircularBuffer;
    +import com.datatorrent.netlet.util.UnsafeBlockingQueue;
    +import com.datatorrent.stram.tuple.Tuple;
    +
    +import static java.lang.Thread.sleep;
    +
    +/**
    + * Abstract Sweepable Reservoir implementation. Implements all methods of {@link SweepableReservoir}
except
    + * {@link SweepableReservoir#sweep}. Classes that extend {@link AbstractReservoir} must
implement
    + * {@link BlockingQueue} interface.
    + */
    +public abstract class AbstractReservoir implements SweepableReservoir, BlockingQueue<Object>
    +{
    +  private static final Logger logger = LoggerFactory.getLogger(AbstractReservoir.class);
    +  static final String reservoirClassNameProperty = "com.datatorrent.stram.engine.Reservoir";
    +  private static final String reservoirDefaultClassName = SpscArrayQueueReservoir.class.getName();
    +
    +  /**
    +   * Reservoir factory. Constructs concrete implementation of {@link AbstractReservoir}
based on
    +   * {@link AbstractReservoir#reservoirClassNameProperty} property.
    +   * @param id reservoir identifier
    +   * @param capacity reservoir capacity
    +   * @return concrete implementation of {@link AbstractReservoir}
    +   */
    +  public static AbstractReservoir newReservoir(final String id, final int capacity)
    +  {
    +    String reservoirClassName = System.getProperty(reservoirClassNameProperty, reservoirDefaultClassName);
    +    if (reservoirClassName.equals(SpscArrayQueueReservoir.class.getName())) {
    --- End diff --
    
    No, they can't be constructed in the else clause due to "private static" declaration.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message