本文整理汇总了Java中com.google.ipc.invalidation.external.client.types.ErrorInfo类的典型用法代码示例。如果您正苦于以下问题:Java ErrorInfo类的具体用法?Java ErrorInfo怎么用?Java ErrorInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ErrorInfo类属于com.google.ipc.invalidation.external.client.types包,在下文中一共展示了ErrorInfo类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: informError
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的package包/类
@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();
}
}
开发者ID:mogoweb,项目名称:365browser,代码行数:11,代码来源:InvalidationClientService.java
示例2: newErrorIntent
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的package包/类
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;
}
开发者ID:mogoweb,项目名称:365browser,代码行数:9,代码来源:ProtocolIntents.java
示例3: handleErrorMessage
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的package包/类
/** 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);
}
}
开发者ID:mogoweb,项目名称:365browser,代码行数:38,代码来源:InvalidationClientCore.java
示例4: informError
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的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);
}
});
}
开发者ID:mogoweb,项目名称:365browser,代码行数:12,代码来源:CheckingInvalidationListener.java
示例5: informError
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的package包/类
@Override
public void informError(ErrorInfo errorInfo) {
Log.e(TAG, "informError: " + errorInfo);
/***********************************************************************************************
* YOUR CODE HERE
*
* Handling of permanent failures is application-specific.
**********************************************************************************************/
}
开发者ID:morristech,项目名称:android-chromium,代码行数:11,代码来源:ExampleListener.java
示例6: newErrorIntent
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的package包/类
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;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:12,代码来源:ProtocolIntents.java
示例7: ParcelableErrorInfo
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的package包/类
/**
* 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);
}
开发者ID:morristech,项目名称:android-chromium,代码行数:10,代码来源:ParcelableErrorInfo.java
示例8: informError
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的package包/类
@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);
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:9,代码来源:InvalidationTestListener.java
示例9: informError
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的package包/类
@Override
public void informError(InvalidationClient client, ErrorInfo errorInfo) {
issueIntent(context, ListenerUpcalls.newErrorIntent(errorInfo));
}
开发者ID:mogoweb,项目名称:365browser,代码行数:5,代码来源:AndroidInvalidationClientImpl.java
示例10: handleIntent
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的package包/类
/**
* 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);
}
}
开发者ID:mogoweb,项目名称:365browser,代码行数:45,代码来源:AndroidInvalidationListenerIntentMapper.java
示例11: informListenerOfPermanentError
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的package包/类
/** 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);
}
开发者ID:mogoweb,项目名称:365browser,代码行数:7,代码来源:TiclService.java
示例12: informError
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的package包/类
@Override
public void informError(InvalidationClient client, ErrorInfo errorInfo) {
AndroidListener.this.informError(errorInfo);
}
开发者ID:mogoweb,项目名称:365browser,代码行数:5,代码来源:AndroidListener.java
示例13: handleIntent
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的package包/类
/**
* 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);
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:45,代码来源:AndroidInvalidationListenerIntentMapper.java
示例14: handleErrorMessage
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的package包/类
/** 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);
}
}
开发者ID:morristech,项目名称:android-chromium,代码行数:42,代码来源:InvalidationClientCore.java
示例15: informError
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的package包/类
@Override
public void informError(InvalidationClient client, ErrorInfo errorInfo) {
Event event = Event.newBuilder(Event.Action.INFORM_ERROR)
.setClientKey(clientKey).setErrorInfo(errorInfo).build();
sendEvent(event);
}
开发者ID:morristech,项目名称:android-chromium,代码行数:7,代码来源:AndroidClientProxy.java
示例16: setErrorInfo
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的package包/类
/**
* Stores error information within an event message.
*/
public Builder setErrorInfo(ErrorInfo errorInfo) {
bundle.putParcelable(Parameter.ERROR, new ParcelableErrorInfo(errorInfo));
return this;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:8,代码来源:Event.java
示例17: getErrorInfo
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的package包/类
/**
* 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;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:8,代码来源:Event.java
示例18: informError
import com.google.ipc.invalidation.external.client.types.ErrorInfo; //导入依赖的package包/类
/**
* Informs the listener about errors that have occurred in the backend.
*
* If the error reason is AUTH_FAILURE, the application may notify the user.
* Otherwise, the application should log the error info for debugging purposes but take no
* other action.
*
* @param client the {@link InvalidationClient} invoking the listener
* @param errorInfo information about the error
*/
void informError(InvalidationClient client, ErrorInfo errorInfo);
开发者ID:mogoweb,项目名称:365browser,代码行数:12,代码来源:InvalidationListener.java
注:本文中的com.google.ipc.invalidation.external.client.types.ErrorInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论