本文整理汇总了Java中com.google.protos.ipc.invalidation.ClientProtocol.InfoMessage类的典型用法代码示例。如果您正苦于以下问题:Java InfoMessage类的具体用法?Java InfoMessage怎么用?Java InfoMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InfoMessage类属于com.google.protos.ipc.invalidation.ClientProtocol包,在下文中一共展示了InfoMessage类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasField
import com.google.protos.ipc.invalidation.ClientProtocol.InfoMessage; //导入依赖的package包/类
/** Returns whether {@code field} is present in {@code message}. */
@Override
@SuppressWarnings("unchecked")
public boolean hasField(MessageLite rawMessage, Descriptor field) {
Preconditions.checkNotNull(rawMessage);
Preconditions.checkNotNull(field);
InfoMessage message = (InfoMessage) rawMessage;
if (field == CLIENT_VERSION) {
return message.hasClientVersion();
}
if (field == CONFIG_PARAMETER) {
return message.getConfigParameterCount() > 0;
}
if (field == PERFORMANCE_COUNTER) {
return message.getPerformanceCounterCount() > 0;
}
if (field == SERVER_REGISTRATION_SUMMARY_REQUESTED) {
return message.hasServerRegistrationSummaryRequested();
}
if (field == CLIENT_CONFIG) {
return message.hasClientConfig();
}
throw new IllegalArgumentException("Bad descriptor: " + field);
}
示例2: getField
import com.google.protos.ipc.invalidation.ClientProtocol.InfoMessage; //导入依赖的package包/类
/** Returns the {@code field} from {@code message}. */
@Override
@SuppressWarnings("unchecked")
public Object getField(MessageLite rawMessage, Descriptor field) {
Preconditions.checkNotNull(rawMessage);
Preconditions.checkNotNull(field);
InfoMessage message = (InfoMessage) rawMessage;
if (field == CLIENT_VERSION) {
return message.getClientVersion();
}
if (field == CONFIG_PARAMETER) {
return message.getConfigParameterList();
}
if (field == PERFORMANCE_COUNTER) {
return message.getPerformanceCounterList();
}
if (field == SERVER_REGISTRATION_SUMMARY_REQUESTED) {
return message.getServerRegistrationSummaryRequested();
}
if (field == CLIENT_CONFIG) {
return message.getClientConfig();
}
throw new IllegalArgumentException("Bad descriptor: " + field);
}
示例3: toCompactString
import com.google.protos.ipc.invalidation.ClientProtocol.InfoMessage; //导入依赖的package包/类
/** See spec in implementation notes. */
public static TextBuilder toCompactString(TextBuilder builder,
InfoMessage infoMessage) {
if (infoMessage == null) {
return builder;
}
builder.appendFormat("InfoMsg: Platform = %s, Is_summary_requested = %s, Perf counters: ",
infoMessage.getClientVersion().getPlatform(),
infoMessage.getServerRegistrationSummaryRequested());
boolean first = true;
for (PropertyRecord record : infoMessage.getPerformanceCounterList()) {
if (!first) {
builder.append(", ");
}
builder.appendFormat("%s = %d", record.getName(), record.getValue());
first = false;
}
return builder;
}
示例4: sendInfoMessage
import com.google.protos.ipc.invalidation.ClientProtocol.InfoMessage; //导入依赖的package包/类
/**
* Sends an info message to the server with the performance counters supplied
* in {@code performanceCounters} and the config supplies in
* {@code configParams}.
*
* @param requestServerRegistrationSummary indicates whether to request the
* server's registration summary
*/
void sendInfoMessage(List<SimplePair<String, Integer>> performanceCounters,
ClientConfigP clientConfig, boolean requestServerRegistrationSummary,
BatchingTask batchingTask) {
Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
InfoMessage.Builder infoMessage = InfoMessage.newBuilder()
.setClientVersion(clientVersion);
// Add configuration parameters.
if (clientConfig != null) {
infoMessage.setClientConfig(clientConfig);
}
// Add performance counters.
for (SimplePair<String, Integer> performanceCounter : performanceCounters) {
PropertyRecord counter =
CommonProtos2.newPropertyRecord(performanceCounter.first, performanceCounter.second);
infoMessage.addPerformanceCounter(counter);
}
// Indicate whether we want the server's registration summary sent back.
infoMessage.setServerRegistrationSummaryRequested(requestServerRegistrationSummary);
// Simply store the message in pendingInfoMessage and send it when the batching task runs.
batcher.setInfoMessage(infoMessage.build());
batchingTask.ensureScheduled("Send-info");
}
示例5: toLazyCompactString
import com.google.protos.ipc.invalidation.ClientProtocol.InfoMessage; //导入依赖的package包/类
/** See spec in implementation notes. */
public static Object toLazyCompactString(final InfoMessage infoMessage) {
return LazyString.toLazyCompactString(infoMessage, new Receiver<TextBuilder>() {
@Override
public void accept(TextBuilder builder) {
toCompactString(builder, infoMessage);
}
});
}
示例6: setInfoMessage
import com.google.protos.ipc.invalidation.ClientProtocol.InfoMessage; //导入依赖的package包/类
/** Sets the info message to be sent. */
void setInfoMessage(InfoMessage msg) {
pendingInfoMessage = msg;
}