Adds a consumer.

 * If an instance of Consumer or its subclasses is given, it is used.
 * If Class is given, initialize its instance, and use it. In this case, the rest arguments are passed to the constructor of the given class.
556411
def consumer(cons, *init_args, &block)
      if cons.instance_of? Class
        cons = cons.new(*init_args)
      end
      ch = ConsumerHelper.new(cons, credential)
      ch.instance_eval &block
      provider.add_consumer(ch.consumer)
    end
409721
public Link<S, T> to(Consumer<S, T> consumer) {
		this.consumer = consumer;
		return this;
	}
884010
def _declare_consumer(self, consumer, nowait=False):
        """"""
        if consumer.queue not in self._open_consumers:
            # Use the ConsumerSet's consumer by default, but if the
            # child consumer has a callback, honor it.
            callback = consumer.callbacks and \
                consumer._receive_callback or self._receive_callback
            self.backend.declare_consumer(queue=consumer.queue,
                                          no_ack=consumer.no_ack,
                                          nowait=nowait,
                                          callback=callback,
                                          consumer_tag=consumer.consumer_tag)
            self._open_consumers[consumer.queue] = consumer.consumer_tag
1013048
public void add(int i, int j, double v)
    {
        consumer.set(i, j, supplier.get(i, j) + v);
    }
176339
@Nonnull
	public static <T> ConsumerBuilder<T> consumer(Consumer<Consumer<T>> consumer) {
		return new ConsumerBuilder(consumer);
	}
1212303
void removeConsumer(ConsumerSessionImpl consumer) {
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.entry(tc, "removeConsumer", consumer);

        _consumerList.remove(consumer);

        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.exit(tc, "removeConsumer");
    }
402978
@Nonnull
	public static <T> LObjIntPredicateBuilder<T> objIntPredicate(Consumer<LObjIntPredicate<T>> consumer) {
		return new LObjIntPredicateBuilder(consumer);
	}
1318718
@SuppressWarnings("unchecked")
	public T newInstance(ClassLoader classLoader) {
		try {
			return (T) compile(classLoader).getConstructor(Object[].class)
					// Because Constructor.newInstance(Object... initargs), we need to load
					// references into a new Object[], otherwise it cannot be compiled.
					.newInstance(new Object[] {references});
		} catch (Exception e) {
			throw new RuntimeException(
				"Could not instantiate generated class '" + className + "'", e);
		}
	}
479040
public void setClassLoader(ClassLoader loader) {
    this.classLoader = loader;
    // Note that this class is immutable after construction, except for the class loader
    // Thus we can pass down the loader to the owner and parameter types once now, no need to pass it down in toType()
    if (this.enclosingType != null) {
      this.enclosingType.setClassLoader(loader);
    }
    if (this.parameters != null) {
      for (TypeRepresentation param: this.parameters) {
        param.setClassLoader(loader);
      }
    }
  }
208146
public static final <T extends Recyclable> T get(Class<T> cls, Consumer<T> initializer)
    {
        T recyclable = null;
        lock.lock();
        try
        {
            List<Recyclable> list = mapList.get(cls);
            if (list != null && !list.isEmpty())
            {
                recyclable = (T) list.remove(list.size()-1);
                log.debug("get recycled %s", recyclable);
            }
        }
        finally
        {
            lock.unlock();
        }
        if (recyclable == null)
        {
            try
            {
                recyclable = cls.newInstance();
                log.debug("create new recycled %s", recyclable);
            }
            catch (InstantiationException | IllegalAccessException ex)
            {
                throw new IllegalArgumentException(ex);
            }
        }
        if (initializer != null)
        {
            initializer.accept(recyclable);
        }
        return (T) recyclable;
    }
371621
@Nonnull
	public static <T> ObjIntConsumerBuilder<T> objIntConsumer(Consumer<ObjIntConsumer<T>> consumer) {
		return new ObjIntConsumerBuilder(consumer);
	}
68221
public boolean add(Object o) {
        if (o instanceof GroupAttrReply == false) {
            return true;
        }
        GroupAttrReply gcr = (GroupAttrReply)o;
        if (gcr.has_failed) {
            has_failed = true;
        }
        return super.add(o);
    }
423334
def add(self, name, extends, **kwargs):
        
        f = extends
        self._push(name=name,
                   module_=f.__module__,
                   class_=f.__name__,
                   method_=f.__name__,
                   is_class_=False,
                   **kwargs)
262106
@Override
	public void registerConsumer(LocalMessageConsumer consumer)
    {
        super.registerConsumer(consumer);
        
        subscriptionsLock.writeLock().lock();
        try
		{
        	LocalTopicSubscription subscription = subscriptionMap.remove(consumer.getSubscriberId());
        	if (subscription == null)
        	{
        		// New subscription
        		storeNewSubscription(consumer);
        	}
        	else
        	{
        		// Remove old subscription
        		removeSubscription(subscription);
        		// Replace by new subscription
        		storeNewSubscription(consumer);
        	}
		}
        finally
        {
        	subscriptionsLock.writeLock().unlock();
        }
    }
1013845
def _start_consumer(self, consumer):
        
        thread = threading.Thread(target=consumer.start,
                                  args=(self._connection,))
        thread.daemon = True
        thread.start()
1023264
protected List<ConsumerHolder> filterConsumersForClass(Class<? extends Consumer> consumerClass) {
        List<ConsumerHolder> consumerHolderSubList = new LinkedList<ConsumerHolder>();
        for (ConsumerHolder consumerHolder : consumerHolders) {
            if (consumerClass.isAssignableFrom(consumerHolder.getConsumer().getClass())) {
                consumerHolderSubList.add(consumerHolder);
            }
        }
        return consumerHolderSubList;
    }
1204908
public <T> Consumer<T> wrap(Throwing.Consumer<T> consumer) {
		return val -> {
			try {
				consumer.accept(val);
			} catch (Throwable e) {
				handler.accept(e);
			}
		};
	}