當前位置: 首頁>>代碼示例>>Java>>正文


Java ServicePool類代碼示例

本文整理匯總了Java中org.apache.camel.spi.ServicePool的典型用法代碼示例。如果您正苦於以下問題:Java ServicePool類的具體用法?Java ServicePool怎麽用?Java ServicePool使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ServicePool類屬於org.apache.camel.spi包,在下文中一共展示了ServicePool類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ProducerCache

import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
public ProducerCache(Object source, CamelContext camelContext, ServicePool<Endpoint, Producer> producerServicePool, Map<String, Producer> cache) {
    this.source = source;
    this.camelContext = camelContext;
    if (producerServicePool == null) {
        // use shared producer pool which lifecycle is managed by CamelContext
        this.pool = camelContext.getProducerServicePool();
        this.stopServicePool = false;
    } else {
        this.pool = producerServicePool;
        this.stopServicePool = true;
    }
    this.producers = cache;
    if (producers instanceof LRUCache) {
        maxCacheSize = ((LRUCache) producers).getMaxCacheSize();
    }

    // only if JMX is enabled
    if (camelContext.getManagementStrategy().getManagementAgent() != null) {
        this.extendedStatistics = camelContext.getManagementStrategy().getManagementAgent().getStatisticsLevel().isExtended();
    } else {
        this.extendedStatistics = false;
    }
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:24,代碼來源:ProducerCache.java

示例2: ConsumerCache

import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
public ConsumerCache(Object source, CamelContext camelContext, Map<String, PollingConsumer> cache, ServicePool<Endpoint, PollingConsumer> pool) {
    this.camelContext = camelContext;
    this.consumers = cache;
    this.source = source;
    this.pool = pool;
    if (consumers instanceof LRUCache) {
        maxCacheSize = ((LRUCache) consumers).getMaxCacheSize();
    }

    // only if JMX is enabled
    if (camelContext.getManagementStrategy().getManagementAgent() != null) {
        this.extendedStatistics = camelContext.getManagementStrategy().getManagementAgent().getStatisticsLevel().isExtended();
    } else {
        this.extendedStatistics = false;
    }
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:17,代碼來源:ConsumerCache.java

示例3: setProducerServicePool

import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
public void setProducerServicePool(ServicePool<Endpoint, Producer> producerServicePool) {
    this.producerServicePool = producerServicePool;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:4,代碼來源:DefaultCamelContext.java

示例4: getProducerServicePool

import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
public ServicePool<Endpoint, Producer> getProducerServicePool() {
    return producerServicePool;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:4,代碼來源:DefaultCamelContext.java

示例5: getPollingConsumerServicePool

import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
public ServicePool<Endpoint, PollingConsumer> getPollingConsumerServicePool() {
    return pollingConsumerServicePool;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:4,代碼來源:DefaultCamelContext.java

示例6: setPollingConsumerServicePool

import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
public void setPollingConsumerServicePool(ServicePool<Endpoint, PollingConsumer> pollingConsumerServicePool) {
    this.pollingConsumerServicePool = pollingConsumerServicePool;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:4,代碼來源:DefaultCamelContext.java

示例7: testSharedProducerServicePoolHitMax

import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
public void testSharedProducerServicePoolHitMax() throws Exception {
    // the default capacity
    assertEquals(100, context.getProducerServicePool().getCapacity());

    // change it
    ServicePool<Endpoint, Producer> pool = context.getProducerServicePool();
    pool.setCapacity(3);
    assertEquals(3, pool.getCapacity());

    Endpoint endpoint = context.getEndpoint("mock:foo");

    assertNull(pool.acquire(endpoint));
    assertEquals(0, pool.size());

    Producer producer = new MyProducer(endpoint);
    producer = pool.addAndAcquire(endpoint, producer);
    assertEquals(0, pool.size());

    Producer producer2 = new MyProducer(endpoint);
    producer2 = pool.addAndAcquire(endpoint, producer2);
    assertEquals(0, pool.size());

    Producer producer3 = new MyProducer(endpoint);
    producer3 = pool.addAndAcquire(endpoint, producer3);
    assertEquals(0, pool.size());

    pool.release(endpoint, producer);
    assertEquals(1, pool.size());

    pool.release(endpoint, producer2);
    assertEquals(2, pool.size());

    pool.release(endpoint, producer3);
    assertEquals(3, pool.size());

    Producer producer4 = new MyProducer(endpoint);
    try {
        producer4 = pool.addAndAcquire(endpoint, producer4);
        fail("Should throw an exception");
    } catch (IllegalStateException e) {
        assertEquals("Queue full", e.getMessage());
    }
    assertEquals(3, pool.size());
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:45,代碼來源:CamelContextSharedProducerServicePoolTest.java

示例8: setProducerServicePool

import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
@Override
public void setProducerServicePool(ServicePool<Endpoint, Producer> servicePool) {
  context.setProducerServicePool(servicePool);
}
 
開發者ID:rvs-fluid-it,項目名稱:microservice-bundle,代碼行數:5,代碼來源:ManagedCamelContext.java

示例9: getProducerServicePool

import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
@Override
public ServicePool<Endpoint, Producer> getProducerServicePool() {
  return context.getProducerServicePool();
}
 
開發者ID:rvs-fluid-it,項目名稱:microservice-bundle,代碼行數:5,代碼來源:ManagedCamelContext.java

示例10: setPollingConsumerServicePool

import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
@Override
public void setPollingConsumerServicePool(ServicePool<Endpoint, PollingConsumer> servicePool) {
  context.setPollingConsumerServicePool(servicePool);
}
 
開發者ID:rvs-fluid-it,項目名稱:microservice-bundle,代碼行數:5,代碼來源:ManagedCamelContext.java

示例11: getPollingConsumerServicePool

import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
@Override
public ServicePool<Endpoint, PollingConsumer> getPollingConsumerServicePool() {
  return context.getPollingConsumerServicePool();
}
 
開發者ID:rvs-fluid-it,項目名稱:microservice-bundle,代碼行數:5,代碼來源:ManagedCamelContext.java

示例12: setProducerServicePool

import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
@Override
public void setProducerServicePool(ServicePool<Endpoint, Producer> servicePool) {
    context.setProducerServicePool(servicePool);
}
 
開發者ID:commercehub-oss,項目名稱:dropwizard-camel,代碼行數:5,代碼來源:ManagedCamelContext.java

示例13: getProducerServicePool

import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
@Override
public ServicePool<Endpoint, Producer> getProducerServicePool() {
    return context.getProducerServicePool();
}
 
開發者ID:commercehub-oss,項目名稱:dropwizard-camel,代碼行數:5,代碼來源:ManagedCamelContext.java

示例14: setPollingConsumerServicePool

import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
@Override
public void setPollingConsumerServicePool(ServicePool<Endpoint, PollingConsumer> servicePool) {
    context.setPollingConsumerServicePool(servicePool);
}
 
開發者ID:commercehub-oss,項目名稱:dropwizard-camel,代碼行數:5,代碼來源:ManagedCamelContext.java

示例15: getPollingConsumerServicePool

import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
@Override
public ServicePool<Endpoint, PollingConsumer> getPollingConsumerServicePool() {
    return context.getPollingConsumerServicePool();
}
 
開發者ID:commercehub-oss,項目名稱:dropwizard-camel,代碼行數:5,代碼來源:ManagedCamelContext.java


注:本文中的org.apache.camel.spi.ServicePool類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。