本文整理汇总了Java中com.google.ipc.invalidation.util.Smearer类的典型用法代码示例。如果您正苦于以下问题:Java Smearer类的具体用法?Java Smearer怎么用?Java Smearer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Smearer类属于com.google.ipc.invalidation.util包,在下文中一共展示了Smearer类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: InvalidationClientCore
import com.google.ipc.invalidation.util.Smearer; //导入依赖的package包/类
/**
* Constructs a client.
*
* @param resources resources to use during execution
* @param random a random number generator
* @param clientType client type code
* @param clientName application identifier for the client
* @param config configuration for the client
* @param applicationName name of the application using the library (for debugging/monitoring)
* @param regManagerState marshalled registration manager state, if any
* @param protocolHandlerState marshalled protocol handler state, if any
* @param listener application callback
*/
private InvalidationClientCore(final SystemResources resources, Random random, int clientType,
final byte[] clientName, ClientConfigP config, String applicationName,
RunStateP ticlRunState,
RegistrationManagerStateP regManagerState,
ProtocolHandlerState protocolHandlerState,
StatisticsState statisticsState,
InvalidationListener listener) {
this.resources = Preconditions.checkNotNull(resources);
this.random = random;
this.logger = Preconditions.checkNotNull(resources.getLogger());
this.internalScheduler = resources.getInternalScheduler();
this.storage = resources.getStorage();
this.config = config;
this.ticlState = (ticlRunState == null) ? new RunState() : new RunState(ticlRunState);
this.smearer = new Smearer(random, this.config.getSmearPercent());
this.applicationClientId = ApplicationClientIdP.create(clientType, new Bytes(clientName));
this.listener = listener;
this.statistics = (statisticsState != null)
? Statistics.deserializeStatistics(resources.getLogger(), statisticsState.getCounter())
: new Statistics();
this.registrationManager = new RegistrationManager(logger, statistics, digestFn,
regManagerState);
this.protocolHandler = new ProtocolHandler(config.getProtocolHandlerConfig(), resources,
smearer, statistics, clientType, applicationName, this, protocolHandlerState);
}
开发者ID:mogoweb,项目名称:365browser,代码行数:39,代码来源:InvalidationClientCore.java
示例2: RecurringTask
import com.google.ipc.invalidation.util.Smearer; //导入依赖的package包/类
/**
* Creates a recurring task with the given parameters. The specs of the parameters are given in
* the instance variables.
* <p>
* The created task is first scheduled with a smeared delay of {@code initialDelayMs}. If the
* {@code this.run()} returns true on its execution, the task is rescheduled after a
* {@code timeoutDelayMs} + smeared delay of {@code initialDelayMs} or {@code timeoutDelayMs} +
* {@code delayGenerator.getNextDelay()} depending on whether the {@code delayGenerator} is null
* or not.
*/
public RecurringTask(String name, Scheduler scheduler, Logger logger, Smearer smearer,
TiclExponentialBackoffDelayGenerator delayGenerator,
final int initialDelayMs, final int timeoutDelayMs) {
this.delayGenerator = delayGenerator;
this.name = Preconditions.checkNotNull(name);
this.logger = Preconditions.checkNotNull(logger);
this.scheduler = Preconditions.checkNotNull(scheduler);
this.smearer = Preconditions.checkNotNull(smearer);
this.initialDelayMs = initialDelayMs;
this.isScheduled = false;
this.timeoutDelayMs = timeoutDelayMs;
// Create a runnable that runs the task. If the task asks for a retry, reschedule it after
// at a timeout delay. Otherwise, resets the delayGenerator.
this.runnable = createRunnable();
}
开发者ID:mogoweb,项目名称:365browser,代码行数:28,代码来源:RecurringTask.java
示例3: ProtocolHandler
import com.google.ipc.invalidation.util.Smearer; //导入依赖的package包/类
/**
* Creates an instance.
*
* @param config configuration for the client
* @param resources resources to use
* @param smearer a smearer to randomize delays
* @param statistics track information about messages sent/received, etc
* @param applicationName name of the application using the library (for debugging/monitoring)
* @param listener callback for protocol events
*/
ProtocolHandler(ProtocolHandlerConfigP config, final SystemResources resources,
Smearer smearer, Statistics statistics, int clientType, String applicationName,
ProtocolListener listener, ProtocolHandlerState marshalledState) {
this.logger = resources.getLogger();
this.statistics = statistics;
this.internalScheduler = resources.getInternalScheduler();
this.network = resources.getNetwork();
this.listener = listener;
this.clientVersion = CommonProtos.newClientVersion(resources.getPlatform(), "Java",
applicationName);
this.clientType = clientType;
if (marshalledState == null) {
// If there is no marshalled state, construct a clean batcher.
this.batcher = new Batcher(resources, statistics);
} else {
// Otherwise, restore the batcher from the marshalled state.
this.batcher = new Batcher(resources, statistics, marshalledState.getBatcherState());
this.messageId = marshalledState.getMessageId();
this.lastKnownServerTimeMs = marshalledState.getLastKnownServerTimeMs();
this.nextMessageSendTimeMs = marshalledState.getNextMessageSendTimeMs();
}
logger.info("Created protocol handler for application %s, platform %s", applicationName,
resources.getPlatform());
}
开发者ID:mogoweb,项目名称:365browser,代码行数:35,代码来源:ProtocolHandler.java
示例4: BatchingTask
import com.google.ipc.invalidation.util.Smearer; //导入依赖的package包/类
/** Creates a new instance with default state. */
BatchingTask(ProtocolHandler protocolHandler, SystemResources resources, Smearer smearer,
int batchingDelayMs) {
super(TASK_NAME, resources.getInternalScheduler(), resources.getLogger(), smearer, null,
batchingDelayMs, NO_DELAY);
this.protocolHandler = protocolHandler;
}
开发者ID:mogoweb,项目名称:365browser,代码行数:8,代码来源:InvalidationClientCore.java
示例5: InvalidationClientCore
import com.google.ipc.invalidation.util.Smearer; //导入依赖的package包/类
/**
* Constructs a client.
*
* @param resources resources to use during execution
* @param random a random number generator
* @param clientType client type code
* @param clientName application identifier for the client
* @param config configuration for the client
* @param applicationName name of the application using the library (for debugging/monitoring)
* @param regManagerState marshalled registration manager state, if any
* @param protocolHandlerState marshalled protocol handler state, if any
* @param listener application callback
*/
private InvalidationClientCore(final SystemResources resources, Random random, int clientType,
final byte[] clientName, ClientConfigP config, String applicationName,
RunStateP ticlRunState,
RegistrationManagerStateP regManagerState,
ProtocolHandlerState protocolHandlerState,
StatisticsState statisticsState,
InvalidationListener listener) {
this.resources = Preconditions.checkNotNull(resources);
this.random = random;
this.logger = Preconditions.checkNotNull(resources.getLogger());
this.internalScheduler = resources.getInternalScheduler();
this.storage = resources.getStorage();
this.config = config;
this.ticlState = (ticlRunState == null) ? new RunState() : new RunState(ticlRunState);
this.smearer = new Smearer(random, this.config.getSmearPercent());
this.applicationClientId =
CommonProtos2.newApplicationClientIdP(clientType, ByteString.copyFrom(clientName));
this.listener = listener;
this.msgValidator = new TiclMessageValidator2(resources.getLogger());
this.statistics = (statisticsState != null) ?
Statistics.deserializeStatistics(resources.getLogger(), statisticsState.getCounterList()) :
new Statistics();
this.registrationManager = new RegistrationManager(logger, statistics, digestFn,
regManagerState);
this.protocolHandler = new ProtocolHandler(config.getProtocolHandlerConfig(), resources,
smearer, statistics, clientType, applicationName, this, msgValidator, protocolHandlerState);
}
开发者ID:morristech,项目名称:android-chromium,代码行数:41,代码来源:InvalidationClientCore.java
示例6: ProtocolHandler
import com.google.ipc.invalidation.util.Smearer; //导入依赖的package包/类
/**
* Creates an instance.
*
* @param config configuration for the client
* @param resources resources to use
* @param smearer a smearer to randomize delays
* @param statistics track information about messages sent/received, etc
* @param applicationName name of the application using the library (for debugging/monitoring)
* @param listener callback for protocol events
*/
ProtocolHandler(ProtocolHandlerConfigP config, final SystemResources resources,
Smearer smearer, Statistics statistics, int clientType, String applicationName,
ProtocolListener listener, TiclMessageValidator2 msgValidator,
ProtocolHandlerState marshalledState) {
this.logger = resources.getLogger();
this.statistics = statistics;
this.internalScheduler = resources.getInternalScheduler();
this.network = resources.getNetwork();
this.listener = listener;
this.msgValidator = msgValidator;
this.clientVersion = CommonProtos2.newClientVersion(resources.getPlatform(), "Java",
applicationName);
this.clientType = clientType;
if (marshalledState == null) {
// If there is no marshalled state, construct a clean batcher.
this.batcher = new Batcher(resources, statistics);
} else {
// Otherwise, restore the batcher from the marshalled state.
this.batcher = new Batcher(resources, statistics, marshalledState.getBatcherState());
this.messageId = marshalledState.getMessageId();
this.lastKnownServerTimeMs = marshalledState.getLastKnownServerTimeMs();
this.nextMessageSendTimeMs = marshalledState.getNextMessageSendTimeMs();
}
logger.info("Created protocol handler for application %s, platform %s", applicationName,
resources.getPlatform());
}
开发者ID:morristech,项目名称:android-chromium,代码行数:37,代码来源:ProtocolHandler.java
示例7: getSmearer
import com.google.ipc.invalidation.util.Smearer; //导入依赖的package包/类
/** Returns the smearer used for randomizing delays. */
Smearer getSmearer() {
return smearer;
}
开发者ID:mogoweb,项目名称:365browser,代码行数:5,代码来源:RecurringTask.java
注:本文中的com.google.ipc.invalidation.util.Smearer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论