本文整理汇总了Java中com.google.ipc.invalidation.common.TiclMessageValidator2类的典型用法代码示例。如果您正苦于以下问题:Java TiclMessageValidator2类的具体用法?Java TiclMessageValidator2怎么用?Java TiclMessageValidator2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TiclMessageValidator2类属于com.google.ipc.invalidation.common包,在下文中一共展示了TiclMessageValidator2类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: InvalidationClientCore
import com.google.ipc.invalidation.common.TiclMessageValidator2; //导入依赖的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);
}
示例2: ProtocolHandler
import com.google.ipc.invalidation.common.TiclMessageValidator2; //导入依赖的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());
}