Returns an object producer.
199335
private <T> BindingAmp<T> findObjectBinding(Key<T> key)
  {
    Objects.requireNonNull(key);

    if (key.qualifiers().length != 1) {
      throw new IllegalArgumentException();

    }
    return (BindingAmp) findBinding(Key.of(Object.class,
                                           key.qualifiers()[0]));
  }
1073279
def _create_producer(self):
        """"""
        if not self.closed:
            try:
                self.logger.debug("Creating new kafka producer using brokers: " +
                                   str(self.settings['KAFKA_HOSTS']))

                return KafkaProducer(bootstrap_servers=self.settings['KAFKA_HOSTS'],
                                     value_serializer=lambda v: json.dumps(v).encode('utf-8'),
                                     retries=3,
                                     linger_ms=self.settings['KAFKA_PRODUCER_BATCH_LINGER_MS'],
                                     buffer_memory=self.settings['KAFKA_PRODUCER_BUFFER_BYTES'])
            except KeyError as e:
                self.logger.error('Missing setting named ' + str(e),
                                   {'ex': traceback.format_exc()})
            except:
                self.logger.error("Couldn't initialize kafka producer.",
                                   {'ex': traceback.format_exc()})
                raise
733374
def _objectListGenerator(self, request, objectList):
        
        return self._topLevelObjectGenerator(
            request, len(objectList), lambda index: objectList[index])
1098491
def request_object(self):
        """"""
        obj_to_return = None
        if self.queue.count > 0:
            obj_to_return = self.__dequeue()
        else:
            #The queue is empty, generate a new item.
            self.__init_object()
            object_to_return = self.__dequeue()
        self.active_objects += 1
        return obj_to_return
501536
public static List<ProducerDecoratorBean> getDecoratedProducers(HttpServletRequest req, List<ProducerAO> producers, Map<String, GraphDataBean> graphData){

        Map<IDecorator, List<ProducerAO>> decoratorMap = new HashMap<>(producers.size());
        for (ProducerAO producer : producers){
            try{
                IDecorator decorator = findOrCreateDecorator(producer);
                List<ProducerAO> decoratedProducers = decoratorMap.get(decorator);
                if (decoratedProducers == null){
                    decoratedProducers = new ArrayList<>();
                    decoratorMap.put(decorator, decoratedProducers);

                    for(StatValueAO statBean : producer.getFirstStatsValues()){
                        String graphKey = decorator.getName()+ '_' +statBean.getName();
                        GraphDataBean graphDataBean = new GraphDataBean(decorator.getName()+ '_' +statBean.getJsVariableName(), statBean.getName());
                        graphData.put(graphKey, graphDataBean);
                    }
                }
                decoratedProducers.add(producer);
            }catch(IndexOutOfBoundsException e){
                //producer has no stats at all, ignoring
            }
        }

        Set<Map.Entry<IDecorator, List<ProducerAO>>> entries = decoratorMap.entrySet();
        List<ProducerDecoratorBean> beans = new ArrayList<>(entries.size());
        for (Map.Entry<IDecorator, List<ProducerAO>> entry : entries){
            IDecorator decorator = entry.getKey();
            ProducerDecoratorBean b = new ProducerDecoratorBean();
            b.setName(decorator.getName());
            b.setCaptions(decorator.getCaptions());

            for (ProducerAO p : entry.getValue()) {
                try {
                    List<StatValueAO> values = p.getFirstStatsValues();
                    for (StatValueAO valueBean : values){
                        String graphKey = decorator.getName()+ '_' +valueBean.getName();
                        GraphDataBean bean = graphData.get(graphKey);
                        if (bean==null) {
                            // FIXME!
                            log.warn("unable to find bean for key: " + graphKey);
                        } else {
                            bean.addValue(new GraphDataValueBean(p.getProducerId(), valueBean.getRawValue()));
                        }
                    }
                }catch(UnknownIntervalException e){
                    //do nothing, apparently we have a decorator which has no interval support for THIS interval.
                }
            }
            b.setProducerBeans(StaticQuickSorter.sort(decoratorMap.get(decorator), getProducerBeanSortType(b, req)));
            beans.add(b);
        }

        return beans;
    }
367752
def produceResource(self, request, segments, webViewer):
        
        def thunk():
            cr = getattr(self, 'createResource', None)
            if cr is not None:
                return cr()
            else:
                return self.createResourceWith(webViewer)
        return self._produceIt(segments, thunk)
1007564
def factory(cls, **kwargs):
    
    for name, obj in inspect.getmembers(sys.modules[__name__]):
        if inspect.isclass(obj) and issubclass(obj, UserAuthnMethod):
            try:
                if obj.__name__ == cls:
                    return obj(**kwargs)
            except AttributeError:
                pass
928521
def factory(cls, class_name):
        
        class_name = str(class_name.lstrip('_'))
        types = ParseResource.__subclasses__()
        while types:
            t = types.pop()
            if t.__name__ == class_name:
                return t
            types.extend(t.__subclasses__())
        else:
            return type(class_name, (Object,), {})
432491
public static <T> ComposableFuture<T> buildLazy(final Producer<T> producer) {
    return LazyComposableFuture.build(producer);
  }
585541
def factory():
        """"""
        if not TransCache.SINGLETON or TransCache._cache_is_expired():
            TransCache.SINGLETON = TransCache()
            TransCache.SINGLETON_CREATION_DATETIME = timezone.now()

        return TransCache.SINGLETON
415990
public T create(final CreationalContext<T> creationalContext) {
        T instance = getProducer().produce(creationalContext);
        instance = checkReturnValue(instance);
        return instance;
    }
964849
public LockEntry getWriter(Object obj)
    {
        PersistenceBroker broker = getBroker();
        Identity oid = new Identity(obj, broker); 
        return getWriter(oid);
    }
1292380
public final ProducerType getProducerType() {
        /* Get the int value and get the corresponding ProducerType to return */
        Byte pType = (Byte) getHdr2().getField(JsHdr2Access.PRODUCERTYPE);
        return ProducerType.getProducerType(pType);
    }
695091
@Override
	public MessageProducer createProducer(Destination destination) throws JMSException
    {
    	externalAccessLock.readLock().lock();
    	try
		{
	        checkNotClosed();
	        LocalMessageProducer producer = new LocalMessageProducer(this,destination,idProvider.createID());
	        registerProducer(producer);
	        return producer;
		}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    }
297382
def get_object(request, pid):
    """"""
    sciobj = d1_gmn.app.models.ScienceObject.objects.get(pid__did=pid)
    content_type_str = d1_gmn.app.object_format_cache.get_content_type(
        sciobj.format.format
    )
    # Return local or proxied SciObj bytes
    response = django.http.StreamingHttpResponse(
        _get_sciobj_iter(sciobj), content_type_str
    )
    d1_gmn.app.views.headers.add_sciobj_properties_headers_to_response(response, sciobj)
    d1_gmn.app.event_log.log_read_event(pid, request)
    return response
1282313
def get_object(
        self, object_t, object_id=None, relation=None, parent=None, **kwargs
    ):
        
        url = self.object_url(object_t, object_id, relation, **kwargs)
        response = self.session.get(url)
        return self._process_json(response.json(), parent)
161388
@Override
    public JMSProducer createProducer() {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createProducer");

        JMSProducer jmsProducer = null;
        try {
            // Create messageproducer first, since we reuse most in jmsproducer
            // destination is passed as null because during send,destination is passed
            // jmssession.createproducer() is not used becuase it stores the list of producers
            // which is not required for simplified API's
            MessageProducer msgProducer = jmsSession.instantiateProducer(null);
            jmsProducer = new JmsJMSProducerImpl(msgProducer);
        } catch (JMSException e) {
            // should never have got here because we pass destination as null so there is no chance 
            // that instantiateProducer() will throw any exception

            FFDCFilter.processException(e,
                                        JmsJMSContextImpl.class.toString() + ".createProducer",
                                        "598", this);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "createProducer");

        return jmsProducer;

    }