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


Java Queues.synchronizedQueue方法代碼示例

本文整理匯總了Java中com.google.common.collect.Queues.synchronizedQueue方法的典型用法代碼示例。如果您正苦於以下問題:Java Queues.synchronizedQueue方法的具體用法?Java Queues.synchronizedQueue怎麽用?Java Queues.synchronizedQueue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.collect.Queues的用法示例。


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

示例1: start

import com.google.common.collect.Queues; //導入方法依賴的package包/類
@Override
public void start() {
    if (this.encoder == null) {
        addError("No encoder set for the appender named ["+ name +"].");
        return;
    }

    try {
        encoder.init(stream);
    } catch (IOException ignored) {
    }

    EvictingQueue<String> q = EvictingQueue.create(limit);
    logList = Queues.synchronizedQueue(q);

    isLoggingOn = true;

    super.start();
}
 
開發者ID:Quiq,項目名稱:dropwizard-wiretap,代碼行數:20,代碼來源:WiretapAppender.java

示例2: RtSolverBidder

import com.google.common.collect.Queues; //導入方法依賴的package包/類
RtSolverBidder(ObjectiveFunction objFunc, RealtimeSolver s,
    BidFunction bidFunc, long cooldown, boolean reauctEnabled) {
  super(SetFactories.synchronizedFactory(SetFactories.linkedHashSet()));
  objectiveFunction = objFunc;
  solver = s;
  solverHandle = Optional.absent();
  bidFunction = bidFunc;
  cfbQueue = Queues.synchronizedQueue(new LinkedList<CallForBids>());
  parcelAuctioneers = new LinkedHashMap<>();
  reauctioning = new AtomicBoolean();
  computing = new AtomicBoolean();
  reauctionCooldownPeriod = cooldown;
  reauctionsEnabled = reauctEnabled;
}
 
開發者ID:rinde,項目名稱:RinLog,代碼行數:15,代碼來源:RtSolverBidder.java

示例3: DefaultJobService

import com.google.common.collect.Queues; //導入方法依賴的package包/類
@Inject
public DefaultJobService(LifeCycleRegistry lifeCycleRegistry,
                         QueueService queueService,
                         @JobQueueName String queueName,
                         JobHandlerRegistryInternal jobHandlerRegistry,
                         JobStatusDAO jobStatusDAO,
                         @JobZooKeeper CuratorFramework curator,
                         @JobConcurrencyLevel Integer concurrencyLevel,
                         @QueueRefreshTime Duration queueRefreshTime,
                         final @QueuePeekLimit Integer queuePeekLimit,
                         @NotOwnerRetryDelay Duration notOwnerRetryDelay) {
    _queueService = checkNotNull(queueService, "queueService");
    _queueName = checkNotNull(queueName, "queueName");
    _jobHandlerRegistry = checkNotNull(jobHandlerRegistry, "jobHandlerRegistry");
    _jobStatusDAO = checkNotNull(jobStatusDAO, "jobStatusDAO");
    _curator = checkNotNull(curator, "curator");
    _concurrencyLevel = checkNotNull(concurrencyLevel, "concurrencyLevel");
    checkArgument(_concurrencyLevel >= 0, "Concurrency level cannot be negative");
    _notOwnerRetryDelay = checkNotNull(notOwnerRetryDelay, "notOwnerRetryDelay");
    checkNotNull(queuePeekLimit, "queuePeekLimit");
    checkNotNull(lifeCycleRegistry, "lifecycleRegistry");

    _recentNotOwnerDelays = CacheBuilder.newBuilder()
            .expireAfterWrite(notOwnerRetryDelay.getMillis(), TimeUnit.MILLISECONDS)
            .build();

    Supplier<Queue<Message>> sourceMessageSupplier = new Supplier<Queue<Message>>() {
        @Override
        public Queue<Message> get() {
            return Queues.synchronizedQueue(Queues.newArrayDeque(_queueService.peek(_queueName, queuePeekLimit)));
        }
    };

    checkNotNull(queueRefreshTime, "queueRefreshTime");
    if (queueRefreshTime.getMillis() == 0) {
        _messageSupplier = sourceMessageSupplier;
    } else {
        _messageSupplier = Suppliers.memoizeWithExpiration(
                sourceMessageSupplier, queueRefreshTime.getMillis(), TimeUnit.MILLISECONDS);
    }

    lifeCycleRegistry.manage(this);
}
 
開發者ID:bazaarvoice,項目名稱:emodb,代碼行數:44,代碼來源:DefaultJobService.java

示例4: synchronizedCircularQueueBuffer

import com.google.common.collect.Queues; //導入方法依賴的package包/類
static Queue<Long> synchronizedCircularQueueBuffer( int bufferSize )
{
    return Queues.synchronizedQueue( EvictingQueue.<Long>create( bufferSize ) );
}
 
開發者ID:ldbc,項目名稱:ldbc_snb_driver,代碼行數:5,代碼來源:LdbcSnbShortReadGenerator.java


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