本文整理匯總了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;
}
}
示例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;
}
}
示例3: setProducerServicePool
import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
public void setProducerServicePool(ServicePool<Endpoint, Producer> producerServicePool) {
this.producerServicePool = producerServicePool;
}
示例4: getProducerServicePool
import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
public ServicePool<Endpoint, Producer> getProducerServicePool() {
return producerServicePool;
}
示例5: getPollingConsumerServicePool
import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
public ServicePool<Endpoint, PollingConsumer> getPollingConsumerServicePool() {
return pollingConsumerServicePool;
}
示例6: setPollingConsumerServicePool
import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
public void setPollingConsumerServicePool(ServicePool<Endpoint, PollingConsumer> pollingConsumerServicePool) {
this.pollingConsumerServicePool = pollingConsumerServicePool;
}
示例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());
}
示例8: setProducerServicePool
import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
@Override
public void setProducerServicePool(ServicePool<Endpoint, Producer> servicePool) {
context.setProducerServicePool(servicePool);
}
示例9: getProducerServicePool
import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
@Override
public ServicePool<Endpoint, Producer> getProducerServicePool() {
return context.getProducerServicePool();
}
示例10: setPollingConsumerServicePool
import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
@Override
public void setPollingConsumerServicePool(ServicePool<Endpoint, PollingConsumer> servicePool) {
context.setPollingConsumerServicePool(servicePool);
}
示例11: getPollingConsumerServicePool
import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
@Override
public ServicePool<Endpoint, PollingConsumer> getPollingConsumerServicePool() {
return context.getPollingConsumerServicePool();
}
示例12: setProducerServicePool
import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
@Override
public void setProducerServicePool(ServicePool<Endpoint, Producer> servicePool) {
context.setProducerServicePool(servicePool);
}
示例13: getProducerServicePool
import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
@Override
public ServicePool<Endpoint, Producer> getProducerServicePool() {
return context.getProducerServicePool();
}
示例14: setPollingConsumerServicePool
import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
@Override
public void setPollingConsumerServicePool(ServicePool<Endpoint, PollingConsumer> servicePool) {
context.setPollingConsumerServicePool(servicePool);
}
示例15: getPollingConsumerServicePool
import org.apache.camel.spi.ServicePool; //導入依賴的package包/類
@Override
public ServicePool<Endpoint, PollingConsumer> getPollingConsumerServicePool() {
return context.getPollingConsumerServicePool();
}