本文整理汇总了Java中com.google.ipc.invalidation.external.client.InvalidationClient类的典型用法代码示例。如果您正苦于以下问题:Java InvalidationClient类的具体用法?Java InvalidationClient怎么用?Java InvalidationClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InvalidationClient类属于com.google.ipc.invalidation.external.client包,在下文中一共展示了InvalidationClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createClient
import com.google.ipc.invalidation.external.client.InvalidationClient; //导入依赖的package包/类
/**
* Creates a new InvalidationClient instance that the proxy will delegate requests to and listen
* for events from.
*/
// Overridden by tests to inject mock clients or for listener interception
InvalidationClient createClient(SystemResources resources, int clientType, byte[] clientName,
String applicationName, InvalidationListener listener, ClientConfigP config) {
// We always use C2DM, so set the channel-supports-offline-delivery bit on our config.
final ClientConfigP.Builder configBuilder;
if (config == null) {
configBuilder = InvalidationClientCore.createConfig();
} else {
configBuilder = ClientConfigP.newBuilder(config);
}
configBuilder.setChannelSupportsOfflineDelivery(true);
config = configBuilder.build();
Random random = new Random(resources.getInternalScheduler().getCurrentTimeMs());
return new InvalidationClientImpl(resources, random, clientType, clientName, config,
applicationName, listener);
}
示例2: invalidate
import com.google.ipc.invalidation.external.client.InvalidationClient; //导入依赖的package包/类
@Override
public void invalidate(InvalidationClient client, Invalidation invalidation,
AckHandle ackHandle) {
try {
AckHandleP ackHandleP = AckHandleP.parseFrom(ackHandle.getHandleData());
issueIntent(context, ListenerUpcalls.newInvalidateIntent(
ProtoWrapperConverter.convertToInvalidationProto(invalidation), ackHandleP));
} catch (ValidationException exception) {
// Log and drop invalid call.
logBadAckHandle("invalidate", ackHandle);
}
}
示例3: invalidateUnknownVersion
import com.google.ipc.invalidation.external.client.InvalidationClient; //导入依赖的package包/类
@Override
public void invalidateUnknownVersion(InvalidationClient client, ObjectId objectId,
AckHandle ackHandle) {
try {
AckHandleP ackHandleP = AckHandleP.parseFrom(ackHandle.getHandleData());
issueIntent(context, ListenerUpcalls.newInvalidateUnknownIntent(
ProtoWrapperConverter.convertToObjectIdProto(objectId), ackHandleP));
} catch (ValidationException exception) {
// Log and drop invalid call.
logBadAckHandle("invalidateUnknownVersion", ackHandle);
}
}
示例4: invalidateAll
import com.google.ipc.invalidation.external.client.InvalidationClient; //导入依赖的package包/类
@Override
public void invalidateAll(InvalidationClient client, AckHandle ackHandle) {
try {
AckHandleP ackHandleP = AckHandleP.parseFrom(ackHandle.getHandleData());
issueIntent(context, ListenerUpcalls.newInvalidateAllIntent(ackHandleP));
} catch (ValidationException exception) {
// Log and drop invalid call.
logBadAckHandle("invalidateAll", ackHandle);
}
}
示例5: informRegistrationStatus
import com.google.ipc.invalidation.external.client.InvalidationClient; //导入依赖的package包/类
@Override
public void informRegistrationStatus(
InvalidationClient client, ObjectId objectId, RegistrationState regState) {
Intent intent = ListenerUpcalls.newRegistrationStatusIntent(
ProtoWrapperConverter.convertToObjectIdProto(objectId),
regState == RegistrationState.REGISTERED);
issueIntent(context, intent);
}
示例6: invalidate
import com.google.ipc.invalidation.external.client.InvalidationClient; //导入依赖的package包/类
@Override
public void invalidate(final InvalidationClient client, final Invalidation invalidation,
final AckHandle ackHandle) {
Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
Preconditions.checkNotNull(ackHandle);
listenerScheduler.schedule(NO_DELAY, new NamedRunnable("CheckingInvalListener.invalidate") {
@Override
public void run() {
statistics.recordListenerEvent(ListenerEventType.INVALIDATE);
delegate.invalidate(client, invalidation, ackHandle);
}
});
}
示例7: invalidateUnknownVersion
import com.google.ipc.invalidation.external.client.InvalidationClient; //导入依赖的package包/类
@Override
public void invalidateUnknownVersion(final InvalidationClient client, final ObjectId objectId,
final AckHandle ackHandle) {
Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
Preconditions.checkNotNull(ackHandle);
listenerScheduler.schedule(NO_DELAY,
new NamedRunnable("CheckingInvalListener.invalidateUnknownVersion") {
@Override
public void run() {
statistics.recordListenerEvent(ListenerEventType.INVALIDATE_UNKNOWN);
delegate.invalidateUnknownVersion(client, objectId, ackHandle);
}
});
}
示例8: invalidateAll
import com.google.ipc.invalidation.external.client.InvalidationClient; //导入依赖的package包/类
@Override
public void invalidateAll(final InvalidationClient client, final AckHandle ackHandle) {
Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
Preconditions.checkNotNull(ackHandle);
listenerScheduler.schedule(NO_DELAY, new NamedRunnable("CheckingInvalListener.invalidateAll") {
@Override
public void run() {
statistics.recordListenerEvent(ListenerEventType.INVALIDATE_ALL);
delegate.invalidateAll(client, ackHandle);
}
});
}
示例9: informRegistrationFailure
import com.google.ipc.invalidation.external.client.InvalidationClient; //导入依赖的package包/类
@Override
public void informRegistrationFailure(final InvalidationClient client, final ObjectId objectId,
final boolean isTransient, final String errorMessage) {
Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
listenerScheduler.schedule(NO_DELAY, new NamedRunnable("CheckingInvalListener.regFailure") {
@Override
public void run() {
statistics.recordListenerEvent(ListenerEventType.INFORM_REGISTRATION_FAILURE);
delegate.informRegistrationFailure(client, objectId, isTransient, errorMessage);
}
});
}
示例10: informRegistrationStatus
import com.google.ipc.invalidation.external.client.InvalidationClient; //导入依赖的package包/类
@Override
public void informRegistrationStatus(final InvalidationClient client, final ObjectId objectId,
final RegistrationState regState) {
Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
listenerScheduler.schedule(NO_DELAY, new NamedRunnable("CheckingInvalListener.regStatus") {
@Override
public void run() {
statistics.recordListenerEvent(ListenerEventType.INFORM_REGISTRATION_STATUS);
delegate.informRegistrationStatus(client, objectId, regState);
}
});
}
示例11: reissueRegistrations
import com.google.ipc.invalidation.external.client.InvalidationClient; //导入依赖的package包/类
@Override
public void reissueRegistrations(final InvalidationClient client, final byte[] prefix,
final int prefixLen) {
Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
listenerScheduler.schedule(NO_DELAY, new NamedRunnable("CheckingInvalListener.reissueRegs") {
@Override
public void run() {
statistics.recordListenerEvent(ListenerEventType.REISSUE_REGISTRATIONS);
delegate.reissueRegistrations(client, prefix, prefixLen);
}
});
}
示例12: informError
import com.google.ipc.invalidation.external.client.InvalidationClient; //导入依赖的package包/类
@Override
public void informError(final InvalidationClient client, final ErrorInfo errorInfo) {
Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
listenerScheduler.schedule(NO_DELAY, new NamedRunnable("CheckingInvalListener.informError") {
@Override
public void run() {
statistics.recordListenerEvent(ListenerEventType.INFORM_ERROR);
delegate.informError(client, errorInfo);
}
});
}
示例13: ready
import com.google.ipc.invalidation.external.client.InvalidationClient; //导入依赖的package包/类
@Override
public void ready(final InvalidationClient client) {
Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
listenerScheduler.schedule(NO_DELAY, new NamedRunnable("CheckingInvalListener.ready") {
@Override
public void run() {
logger.info("Informing app that ticl is ready");
delegate.ready(client);
}
});
}
示例14: informRegistrationStatus
import com.google.ipc.invalidation.external.client.InvalidationClient; //导入依赖的package包/类
@Override
public final void informRegistrationStatus(final InvalidationClient client,
final ObjectId objectId, final RegistrationState regState) {
state.informRegistrationSuccess(objectId);
AndroidListener.this.informRegistrationStatus(state.getClientId().getByteArray(), objectId,
regState);
}
示例15: informRegistrationFailure
import com.google.ipc.invalidation.external.client.InvalidationClient; //导入依赖的package包/类
@Override
public final void informRegistrationFailure(final InvalidationClient client,
final ObjectId objectId, final boolean isTransient, final String errorMessage) {
state.informRegistrationFailure(objectId, isTransient);
AndroidListener.this.informRegistrationFailure(state.getClientId().getByteArray(), objectId,
isTransient, errorMessage);
}