com.google.ipc.invalidation.external.client.types.ErrorInfo Java Examples
The following examples show how to use
com.google.ipc.invalidation.external.client.types.ErrorInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProtocolIntents.java From 365browser with Apache License 2.0 | 5 votes |
public static Intent newErrorIntent(ErrorInfo errorInfo) { Intent intent = new Intent(); ErrorUpcall errorUpcall = ErrorUpcall.create(errorInfo.getErrorReason(), errorInfo.getErrorMessage(), errorInfo.isTransient()); intent.putExtra(LISTENER_UPCALL_KEY, ListenerUpcall.createWithError( ANDROID_PROTOCOL_VERSION_VALUE, errorUpcall).toByteArray()); return intent; }
Example #2
Source File: InvalidationTestListener.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void informError(InvalidationClient client, ErrorInfo errorInfo) { InvalidationListener listener = getListener(client); logger.fine("Received INFORM_ERROR for %s: %s", getClientKey(client), listener); if (listener != null) { listener.informError(client, errorInfo); } }
Example #3
Source File: ParcelableErrorInfo.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * Creates a new ErrorInfo wrapper by reading data from a parcel. */ public ParcelableErrorInfo(Parcel in) { int reason = in.readInt(); boolean isTransient = in.createBooleanArray()[0]; String message = in.readString(); this.errorInfo = ErrorInfo.newInstance(reason, isTransient, message, null); }
Example #4
Source File: CheckingInvalidationListener.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
@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); } }); }
Example #5
Source File: ProtocolIntents.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
public static Intent newErrorIntent(ErrorInfo errorInfo) { Intent intent = new Intent(); ErrorUpcall errorUpcall = ErrorUpcall.newBuilder() .setErrorCode(errorInfo.getErrorReason()) .setErrorMessage(errorInfo.getErrorMessage()) .setIsTransient(errorInfo.isTransient()) .build(); intent.putExtra(LISTENER_UPCALL_KEY, newBuilder().setError(errorUpcall).build().toByteArray()); return intent; }
Example #6
Source File: ExampleListener.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void informError(ErrorInfo errorInfo) { Log.e(TAG, "informError: " + errorInfo); /*********************************************************************************************** * YOUR CODE HERE * * Handling of permanent failures is application-specific. **********************************************************************************************/ }
Example #7
Source File: InvalidationService.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void informError(ErrorInfo errorInfo) { Log.w(TAG, "Invalidation client error:" + errorInfo); if (!errorInfo.isTransient() && sIsClientStarted) { // It is important not to stop the client if it is already stopped. Otherwise, the // possibility exists to go into an infinite loop if the stop call itself triggers an // error (e.g., because no client actually exists). stopClient(); } }
Example #8
Source File: InvalidationTestListener.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void informError(InvalidationClient client, ErrorInfo errorInfo) { InvalidationListener listener = getListener(client); logger.fine("Received INFORM_ERROR for %s: %s", getClientKey(client), listener); if (listener != null) { listener.informError(client, errorInfo); } }
Example #9
Source File: ParcelableErrorInfo.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * Creates a new ErrorInfo wrapper by reading data from a parcel. */ public ParcelableErrorInfo(Parcel in) { int reason = in.readInt(); boolean isTransient = in.createBooleanArray()[0]; String message = in.readString(); this.errorInfo = ErrorInfo.newInstance(reason, isTransient, message, null); }
Example #10
Source File: CheckingInvalidationListener.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
@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); } }); }
Example #11
Source File: ProtocolIntents.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
public static Intent newErrorIntent(ErrorInfo errorInfo) { Intent intent = new Intent(); ErrorUpcall errorUpcall = ErrorUpcall.newBuilder() .setErrorCode(errorInfo.getErrorReason()) .setErrorMessage(errorInfo.getErrorMessage()) .setIsTransient(errorInfo.isTransient()) .build(); intent.putExtra(LISTENER_UPCALL_KEY, newBuilder().setError(errorUpcall).build().toByteArray()); return intent; }
Example #12
Source File: CheckingInvalidationListener.java From 365browser with Apache License 2.0 | 5 votes |
@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); } }); }
Example #13
Source File: InvalidationClientService.java From 365browser with Apache License 2.0 | 5 votes |
@Override public void informError(ErrorInfo errorInfo) { Log.w(TAG, "Invalidation client error:" + errorInfo); if (!errorInfo.isTransient() && sIsClientStarted) { // It is important not to stop the client if it is already stopped. Otherwise, the // possibility exists to go into an infinite loop if the stop call itself triggers an // error (e.g., because no client actually exists). stopClient(); } }
Example #14
Source File: InvalidationClientCore.java From 365browser with Apache License 2.0 | 5 votes |
/** Handles an error message. */ private void handleErrorMessage(ServerMessageHeader header, int code, String description) { Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread"); // If it is an auth failure, we shut down the ticl. logger.severe("Received error message: %s, %s, %s", header, code, description); // Translate the code to error reason. int reason; switch (code) { case ErrorMessage.Code.AUTH_FAILURE: reason = ErrorInfo.ErrorReason.AUTH_FAILURE; break; case ErrorMessage.Code.UNKNOWN_FAILURE: default: reason = ErrorInfo.ErrorReason.UNKNOWN_FAILURE; break; } // Issue an informError to the application. ErrorInfo errorInfo = ErrorInfo.newInstance(reason, false, description, null); listener.informError(this, errorInfo); // If this is an auth failure, remove registrations and stop the Ticl. Otherwise do nothing. if (code != ErrorMessage.Code.AUTH_FAILURE) { return; } // If there are any registrations, remove them and issue registration failure. Collection<ObjectIdP> desiredRegistrations = registrationManager.removeRegisteredObjects(); logger.warning("Issuing failure for %s objects", desiredRegistrations.size()); for (ObjectIdP objectId : desiredRegistrations) { listener.informRegistrationFailure(this, ProtoWrapperConverter.convertFromObjectIdProto(objectId), false, "Auth error: " + description); } }
Example #15
Source File: ExampleListener.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void informError(ErrorInfo errorInfo) { Log.e(TAG, "informError: " + errorInfo); /*********************************************************************************************** * YOUR CODE HERE * * Handling of permanent failures is application-specific. **********************************************************************************************/ }
Example #16
Source File: InvalidationService.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void informError(ErrorInfo errorInfo) { Log.w(TAG, "Invalidation client error:" + errorInfo); if (!errorInfo.isTransient() && sIsClientStarted) { // It is important not to stop the client if it is already stopped. Otherwise, the // possibility exists to go into an infinite loop if the stop call itself triggers an // error (e.g., because no client actually exists). stopClient(); } }
Example #17
Source File: TiclService.java From 365browser with Apache License 2.0 | 4 votes |
/** Informs the listener of a non-retryable {@code error}. */ private void informListenerOfPermanentError(final String error) { ErrorInfo errorInfo = ErrorInfo.newInstance(0, false, error, null); Intent errorIntent = ProtocolIntents.ListenerUpcalls.newErrorIntent(errorInfo); IntentForwardingListener.issueIntent(this, errorIntent); }
Example #18
Source File: AndroidListener.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void informError(InvalidationClient client, ErrorInfo errorInfo) { AndroidListener.this.informError(errorInfo); }
Example #19
Source File: AndroidInvalidationClientImpl.java From 365browser with Apache License 2.0 | 4 votes |
@Override public void informError(InvalidationClient client, ErrorInfo errorInfo) { issueIntent(context, ListenerUpcalls.newErrorIntent(errorInfo)); }
Example #20
Source File: ParcelableErrorInfo.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
/** * Creates a new wrapper around the provided error info. */ ParcelableErrorInfo(ErrorInfo errorInfo) { this.errorInfo = errorInfo; }
Example #21
Source File: Event.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
/** * Returns the error information from an event message, or {@code null} if not present. */ public ErrorInfo getErrorInfo() { ParcelableErrorInfo parcelableErrorInfo = parameters.getParcelable(Parameter.ERROR); return parcelableErrorInfo != null ? parcelableErrorInfo.errorInfo : null; }
Example #22
Source File: Event.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
/** * Stores error information within an event message. */ public Builder setErrorInfo(ErrorInfo errorInfo) { bundle.putParcelable(Parameter.ERROR, new ParcelableErrorInfo(errorInfo)); return this; }
Example #23
Source File: AndroidClientProxy.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void informError(InvalidationClient client, ErrorInfo errorInfo) { Event event = Event.newBuilder(Event.Action.INFORM_ERROR) .setClientKey(clientKey).setErrorInfo(errorInfo).build(); sendEvent(event); }
Example #24
Source File: AndroidInvalidationListenerIntentMapper.java From 365browser with Apache License 2.0 | 4 votes |
/** * Handles a listener upcall by decoding the protocol buffer in {@code intent} and dispatching * to the appropriate method on the {@link #listener}. */ public void handleIntent(Intent intent) { // TODO: use wakelocks // Unmarshall the arguments from the Intent and make the appropriate call on the listener. ListenerUpcall upcall = tryParseIntent(intent); if (upcall == null) { return; } if (upcall.hasReady()) { listener.ready(client); } else if (upcall.getNullableInvalidate() != null) { // Handle all invalidation-related upcalls on a common path, since they require creating // an AckHandleP. onInvalidateUpcall(upcall.getNullableInvalidate(), listener); } else if (upcall.getNullableRegistrationStatus() != null) { RegistrationStatusUpcall regStatus = upcall.getNullableRegistrationStatus(); listener.informRegistrationStatus(client, ProtoWrapperConverter.convertFromObjectIdProto(regStatus.getObjectId()), regStatus.getIsRegistered() ? RegistrationState.REGISTERED : RegistrationState.UNREGISTERED); } else if (upcall.getNullableRegistrationFailure() != null) { RegistrationFailureUpcall failure = upcall.getNullableRegistrationFailure(); listener.informRegistrationFailure(client, ProtoWrapperConverter.convertFromObjectIdProto(failure.getObjectId()), failure.getTransient(), failure.getMessage()); } else if (upcall.getNullableReissueRegistrations() != null) { ReissueRegistrationsUpcall reissueRegs = upcall.getNullableReissueRegistrations(); listener.reissueRegistrations(client, reissueRegs.getPrefix().getByteArray(), reissueRegs.getLength()); } else if (upcall.getNullableError() != null) { ErrorUpcall error = upcall.getNullableError(); ErrorInfo errorInfo = ErrorInfo.newInstance(error.getErrorCode(), error.getIsTransient(), error.getErrorMessage(), null); listener.informError(client, errorInfo); } else { logger.warning("Dropping listener Intent with unknown call: %s", upcall); } }
Example #25
Source File: InvalidationClientCore.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
/** Handles an error message. */ private void handleErrorMessage(ServerMessageHeader header, ErrorMessage.Code code, String description) { Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread"); // If it is an auth failure, we shut down the ticl. logger.severe("Received error message: %s, %s, %s", header, code, description); // Translate the code to error reason. int reason; switch (code) { case AUTH_FAILURE: reason = ErrorInfo.ErrorReason.AUTH_FAILURE; break; case UNKNOWN_FAILURE: reason = ErrorInfo.ErrorReason.UNKNOWN_FAILURE; break; default: reason = ErrorInfo.ErrorReason.UNKNOWN_FAILURE; break; } // Issue an informError to the application. ErrorInfo errorInfo = ErrorInfo.newInstance(reason, false, description, null); listener.informError(this, errorInfo); // If this is an auth failure, remove registrations and stop the Ticl. Otherwise do nothing. if (code != ErrorMessage.Code.AUTH_FAILURE) { return; } // If there are any registrations, remove them and issue registration failure. Collection<ProtoWrapper<ObjectIdP>> desiredRegistrations = registrationManager.removeRegisteredObjects(); logger.warning("Issuing failure for %s objects", desiredRegistrations.size()); for (ProtoWrapper<ObjectIdP> objectIdWrapper : desiredRegistrations) { ObjectIdP objectId = objectIdWrapper.getProto(); listener.informRegistrationFailure(this, ProtoConverter.convertFromObjectIdProto(objectId), false, "Auth error: " + description); } }
Example #26
Source File: TiclService.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
/** Informs the listener of a non-retryable {@code error}. */ private void informListenerOfPermanentError(final String error) { ErrorInfo errorInfo = ErrorInfo.newInstance(0, false, error, null); Intent errorIntent = ProtocolIntents.ListenerUpcalls.newErrorIntent(errorInfo); IntentForwardingListener.issueIntent(this, errorIntent); }
Example #27
Source File: AndroidInvalidationListenerIntentMapper.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
/** * Handles a listener upcall by decoding the protocol buffer in {@code intent} and dispatching * to the appropriate method on the {@link #listener}. */ public void handleIntent(Intent intent) { // TODO: use wakelocks // Unmarshall the arguments from the Intent and make the appropriate call on the listener. ListenerUpcall upcall = tryParseIntent(intent); if (upcall == null) { return; } if (upcall.hasReady()) { listener.ready(client); } else if (upcall.hasInvalidate()) { // Handle all invalidation-related upcalls on a common path, since they require creating // an AckHandleP. onInvalidateUpcall(upcall, listener); } else if (upcall.hasRegistrationStatus()) { RegistrationStatusUpcall regStatus = upcall.getRegistrationStatus(); listener.informRegistrationStatus(client, ProtoConverter.convertFromObjectIdProto(regStatus.getObjectId()), regStatus.getIsRegistered() ? RegistrationState.REGISTERED : RegistrationState.UNREGISTERED); } else if (upcall.hasRegistrationFailure()) { RegistrationFailureUpcall failure = upcall.getRegistrationFailure(); listener.informRegistrationFailure(client, ProtoConverter.convertFromObjectIdProto(failure.getObjectId()), failure.getTransient(), failure.getMessage()); } else if (upcall.hasReissueRegistrations()) { ReissueRegistrationsUpcall reissueRegs = upcall.getReissueRegistrations(); listener.reissueRegistrations(client, reissueRegs.getPrefix().toByteArray(), reissueRegs.getLength()); } else if (upcall.hasError()) { ErrorUpcall error = upcall.getError(); ErrorInfo errorInfo = ErrorInfo.newInstance(error.getErrorCode(), error.getIsTransient(), error.getErrorMessage(), null); listener.informError(client, errorInfo); } else { logger.warning("Dropping listener Intent with unknown call: %s", upcall); } }
Example #28
Source File: AndroidInvalidationClientImpl.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void informError(InvalidationClient client, ErrorInfo errorInfo) { issueIntent(context, ListenerUpcalls.newErrorIntent(errorInfo)); }
Example #29
Source File: TiclService.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
/** Informs the listener of a non-retryable {@code error}. */ private void informListenerOfPermanentError(final String error) { ErrorInfo errorInfo = ErrorInfo.newInstance(0, false, error, null); Intent errorIntent = ProtocolIntents.ListenerUpcalls.newErrorIntent(errorInfo); IntentForwardingListener.issueIntent(this, errorIntent); }
Example #30
Source File: AndroidInvalidationClientImpl.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void informError(InvalidationClient client, ErrorInfo errorInfo) { issueIntent(context, ListenerUpcalls.newErrorIntent(errorInfo)); }