本文整理汇总了Java中com.google.ipc.invalidation.external.client.SystemResources.NetworkChannel类的典型用法代码示例。如果您正苦于以下问题:Java NetworkChannel类的具体用法?Java NetworkChannel怎么用?Java NetworkChannel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NetworkChannel类属于com.google.ipc.invalidation.external.client.SystemResources包,在下文中一共展示了NetworkChannel类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: registerWithNetwork
import com.google.ipc.invalidation.external.client.SystemResources.NetworkChannel; //导入依赖的package包/类
/**
* Registers handlers for received messages and network status changes with the network of
* {@code resources}.
*/
private void registerWithNetwork(final SystemResources resources) {
resources.getNetwork().setListener(new NetworkChannel.NetworkListener() {
@Override
public void onMessageReceived(byte[] incomingMessage) {
InvalidationClientCore.this.handleIncomingMessage(incomingMessage);
}
@Override
public void onOnlineStatusChange(boolean isOnline) {
InvalidationClientCore.this.handleNetworkStatusChange(isOnline);
}
@Override
public void onAddressChange() {
// Send a message to the server. The header will include the new network address.
Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
sendInfoMessageToServer(false, false);
}
});
}
开发者ID:mogoweb,项目名称:365browser,代码行数:23,代码来源:InvalidationClientCore.java
示例2: registerWithNetwork
import com.google.ipc.invalidation.external.client.SystemResources.NetworkChannel; //导入依赖的package包/类
/**
* Registers handlers for received messages and network status changes with the network of
* {@code resources}.
*/
private void registerWithNetwork(final SystemResources resources) {
resources.getNetwork().setListener(new NetworkChannel.NetworkListener() {
@Override
public void onMessageReceived(byte[] incomingMessage) {
final String name = "handleIncomingMessage";
InvalidationClientCore.this.handleIncomingMessage(incomingMessage);
}
@Override
public void onOnlineStatusChange(boolean isOnline) {
InvalidationClientCore.this.handleNetworkStatusChange(isOnline);
}
@Override
public void onAddressChange() {
// Send a message to the server. The header will include the new network address.
Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
sendInfoMessageToServer(false, false);
}
});
}
开发者ID:morristech,项目名称:android-chromium,代码行数:24,代码来源:InvalidationClientCore.java
示例3: getNetworkIdForTest
import com.google.ipc.invalidation.external.client.SystemResources.NetworkChannel; //导入依赖的package包/类
@Override
public NetworkEndpointId getNetworkIdForTest() {
NetworkChannel network = resources.getNetwork();
if (!(network instanceof TestableNetworkChannel)) {
throw new UnsupportedOperationException(
"getNetworkIdForTest requires a TestableNetworkChannel, not: " + network.getClass());
}
return ((TestableNetworkChannel) network).getNetworkIdForTest();
}
开发者ID:mogoweb,项目名称:365browser,代码行数:10,代码来源:InvalidationClientCore.java
示例4: SystemResourcesBuilder
import com.google.ipc.invalidation.external.client.SystemResources.NetworkChannel; //导入依赖的package包/类
/** See specs at {@code DefaultResourcesFactory.createDefaultResourcesBuilder}. */
public SystemResourcesBuilder(Logger logger, Scheduler internalScheduler,
Scheduler listenerScheduler, NetworkChannel network, Storage storage) {
this.logger = logger;
this.internalScheduler = internalScheduler;
this.listenerScheduler = listenerScheduler;
this.network = network;
this.storage = storage;
}
开发者ID:mogoweb,项目名称:365browser,代码行数:10,代码来源:SystemResourcesBuilder.java
示例5: AndroidResources
import com.google.ipc.invalidation.external.client.SystemResources.NetworkChannel; //导入依赖的package包/类
/** Creates an instance for test from the provided resources and context. */
AndroidResources(Logger logger, AndroidInternalScheduler internalScheduler,
NetworkChannel network, Storage storage, Context context) {
super(logger, internalScheduler, new InvalidScheduler(), network, storage,
getPlatformString());
this.context = Preconditions.checkNotNull(context);
}
开发者ID:morristech,项目名称:android-chromium,代码行数:9,代码来源:ResourcesFactory.java
示例6: createResourcesBuilder
import com.google.ipc.invalidation.external.client.SystemResources.NetworkChannel; //导入依赖的package包/类
/**
* Constructs a {@link SystemResourcesBuilder} instance using default scheduling, Android-style
* logging, and storage, and using {@code network} to send and receive messages.
*/
public static SystemResourcesBuilder createResourcesBuilder(String logPrefix,
NetworkChannel network, Storage storage) {
SystemResourcesBuilder builder = new SystemResourcesBuilder(AndroidLogger.forPrefix(logPrefix),
new ExecutorBasedScheduler("ticl" + logPrefix),
new ExecutorBasedScheduler("ticl-listener" + logPrefix),
network, storage);
builder.setPlatform("Android-" + android.os.Build.VERSION.RELEASE);
return builder;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:14,代码来源:AndroidResourcesFactory.java
示例7: getNetwork
import com.google.ipc.invalidation.external.client.SystemResources.NetworkChannel; //导入依赖的package包/类
/** Returns the network channel. */
public NetworkChannel getNetwork() {
return network;
}
开发者ID:mogoweb,项目名称:365browser,代码行数:5,代码来源:SystemResourcesBuilder.java
示例8: setNetwork
import com.google.ipc.invalidation.external.client.SystemResources.NetworkChannel; //导入依赖的package包/类
/**
* Sets the network channel for communicating with the server to be {@code network}.
* <p>
* REQUIRES: {@link #build} has not been called.
*/
public SystemResourcesBuilder setNetwork(NetworkChannel network) {
Preconditions.checkState(!sealed, "Builder's build method has already been called");
this.network = network;
return this;
}
开发者ID:mogoweb,项目名称:365browser,代码行数:11,代码来源:SystemResourcesBuilder.java
示例9: setNetworkListener
import com.google.ipc.invalidation.external.client.SystemResources.NetworkChannel; //导入依赖的package包/类
/**
* Sets the network message listener provided by the Ticl. The network calls this method when
* the Ticl provides it with a listener; the Ticl service later retrieves the listener when
* it has a network event to communicate to the Ticl.
*/
public void setNetworkListener(NetworkChannel.NetworkListener networkListener) {
Preconditions.checkState(this.networkListener == null, "Listener already set: %s",
networkListener);
this.networkListener = Preconditions.checkNotNull(networkListener);
}
开发者ID:morristech,项目名称:android-chromium,代码行数:11,代码来源:ResourcesFactory.java
示例10: getNetworkListener
import com.google.ipc.invalidation.external.client.SystemResources.NetworkChannel; //导入依赖的package包/类
/** Returns the network listener provided by the Ticl. */
NetworkChannel.NetworkListener getNetworkListener() {
return Preconditions.checkNotNull(networkListener, "network listener not yet set");
}
开发者ID:morristech,项目名称:android-chromium,代码行数:5,代码来源:ResourcesFactory.java
示例11: setListener
import com.google.ipc.invalidation.external.client.SystemResources.NetworkChannel; //导入依赖的package包/类
@Override
public void setListener(NetworkChannel.NetworkListener listener) {
this.listener = Preconditions.checkNotNull(listener);
}
开发者ID:morristech,项目名称:android-chromium,代码行数:5,代码来源:AndroidChannel.java
注:本文中的com.google.ipc.invalidation.external.client.SystemResources.NetworkChannel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论