本文整理匯總了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();
}
示例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;
}
示例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);
}
示例4: synchronizedCircularQueueBuffer
import com.google.common.collect.Queues; //導入方法依賴的package包/類
static Queue<Long> synchronizedCircularQueueBuffer( int bufferSize )
{
return Queues.synchronizedQueue( EvictingQueue.<Long>create( bufferSize ) );
}