本文整理汇总了Java中com.google.ipc.invalidation.external.client.android.service.ServiceBinder.BoundWork类的典型用法代码示例。如果您正苦于以下问题:Java BoundWork类的具体用法?Java BoundWork怎么用?Java BoundWork使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BoundWork类属于com.google.ipc.invalidation.external.client.android.service.ServiceBinder包,在下文中一共展示了BoundWork类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: executeServiceRequest
点赞 3
import com.google.ipc.invalidation.external.client.android.service.ServiceBinder.BoundWork; //导入依赖的package包/类
/**
* Executes a request against the invalidation service and does common error processing against
* the resulting response. If unable to connect to the service or an error status is received from
* it, a warning will be logged and the request will be dropped.
*
* @param request the request to execute.
*/
private void executeServiceRequest(final Request request) {
serviceBinder.runWhenBound(new BoundWork<InvalidationService>() {
@Override
public void run(InvalidationService service) {
Bundle outBundle = new Bundle();
try {
service.handleRequest(request.getBundle(), outBundle);
} catch (RemoteException exception) {
logger.warning("Remote exeption executing request %s: %s", request,
exception.getMessage());
}
Response response = new Response(outBundle);
response.warnOnFailure();
}
});
}
开发者ID:morristech,
项目名称:android-chromium,
代码行数:24,
代码来源:AndroidInvalidationClientImpl.java
示例2: sendEvent
点赞 3
import com.google.ipc.invalidation.external.client.android.service.ServiceBinder.BoundWork; //导入依赖的package包/类
@Override
public void sendEvent(final Bundle eventBundle) {
synchronized (LOCK) {
// Retrive info for that target client
String clientKey = eventBundle.getString(Parameter.CLIENT);
ClientState state = clientMap.get(clientKey);
Preconditions.checkNotNull(state, "No state for %s in %s", clientKey, clientMap.keySet());
// Bind to the listener associated with the client and send the event
ListenerBinder binder = new ListenerBinder(getBaseContext(), state.eventIntent,
InvalidationTestListener.class.getName());
binder.runWhenBound(new BoundWork<ListenerService>() {
@Override
public void run(ListenerService service) {
InvalidationTestService.this.sendEvent(service, new Event(eventBundle));
}
});
// Will happen after the runWhenBound invokes the receiver. Could also be done inside
// the receiver.
binder.release();
}
}
开发者ID:morristech,
项目名称:android-chromium,
代码行数:24,
代码来源:InvalidationTestService.java
示例3: sendEvent
点赞 2
import com.google.ipc.invalidation.external.client.android.service.ServiceBinder.BoundWork; //导入依赖的package包/类
/**
* Send event messages to application clients and provides common processing of the response.
*/
private void sendEvent(final Event event) {
binder.runWhenBound(new BoundWork<ListenerService>() {
@Override
public void run(ListenerService listenerService) {
logger.fine("Sending %s event to %s", event.getAction(), clientKey);
service.sendEvent(listenerService, event);
}
});
}
开发者ID:morristech,
项目名称:android-chromium,
代码行数:13,
代码来源:AndroidClientProxy.java