本文整理汇总了Java中org.sdnplatform.sync.internal.store.SynchronizingStorageEngine.entries方法的典型用法代码示例。如果您正苦于以下问题:Java SynchronizingStorageEngine.entries方法的具体用法?Java SynchronizingStorageEngine.entries怎么用?Java SynchronizingStorageEngine.entries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sdnplatform.sync.internal.store.SynchronizingStorageEngine
的用法示例。
在下文中一共展示了SynchronizingStorageEngine.entries方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: antientropy
import org.sdnplatform.sync.internal.store.SynchronizingStorageEngine; //导入方法依赖的package包/类
/**
* Perform a synchronization with the node specified
*/
public void antientropy(Node node) {
if (!rpcService.isConnected(node.getNodeId())) return;
logger.info("[{}->{}] Synchronizing local state to remote node",
getLocalNodeId(), node.getNodeId());
for (SynchronizingStorageEngine store : storeRegistry.values()) {
if (Scope.LOCAL.equals(store.getScope())) {
if (node.getDomainId() !=
getClusterConfig().getNode().getDomainId())
continue;
} else if (Scope.UNSYNCHRONIZED.equals(store.getScope())) {
continue;
}
IClosableIterator<Entry<ByteArray,
List<Versioned<byte[]>>>> entries =
store.entries();
try {
SyncMessage bsm =
TProtocolUtil.getTSyncOfferMessage(store.getName(),
store.getScope(),
store.isPersistent());
int count = 0;
while (entries.hasNext()) {
if (!rpcService.isConnected(node.getNodeId())) return;
Entry<ByteArray, List<Versioned<byte[]>>> pair =
entries.next();
KeyedVersions kv =
TProtocolUtil.getTKeyedVersions(pair.getKey(),
pair.getValue());
bsm.getSyncOffer().addToVersions(kv);
count += 1;
if (count >= 50) {
sendSyncOffer(node.getNodeId(), bsm);
// realloc sync message - it is still queued up by netty!
bsm = TProtocolUtil.getTSyncOfferMessage(store.getName(),
store.getScope(),
store.isPersistent());
count = 0;
}
}
sendSyncOffer(node.getNodeId(), bsm);
} catch (InterruptedException e) {
// This can't really happen
throw new RuntimeException(e);
} finally {
entries.close();
}
}
}
示例2: antientropy
import org.sdnplatform.sync.internal.store.SynchronizingStorageEngine; //导入方法依赖的package包/类
/**
* Perform a synchronization with the node specified
*/
@LogMessageDoc(level="INFO",
message="[{id}->{id}] Synchronizing local state to remote node",
explanation="Normal state resynchronization is occurring")
public void antientropy(Node node) {
if (!rpcService.isConnected(node.getNodeId())) return;
logger.info("[{}->{}] Synchronizing local state to remote node",
getLocalNodeId(), node.getNodeId());
for (SynchronizingStorageEngine store : storeRegistry.values()) {
if (Scope.LOCAL.equals(store.getScope())) {
if (node.getDomainId() !=
getClusterConfig().getNode().getDomainId())
continue;
} else if (Scope.UNSYNCHRONIZED.equals(store.getScope())) {
continue;
}
IClosableIterator<Entry<ByteArray,
List<Versioned<byte[]>>>> entries =
store.entries();
try {
SyncMessage bsm =
TProtocolUtil.getTSyncOfferMessage(store.getName(),
store.getScope(),
store.isPersistent());
int count = 0;
while (entries.hasNext()) {
if (!rpcService.isConnected(node.getNodeId())) return;
Entry<ByteArray, List<Versioned<byte[]>>> pair =
entries.next();
KeyedVersions kv =
TProtocolUtil.getTKeyedVersions(pair.getKey(),
pair.getValue());
bsm.getSyncOffer().addToVersions(kv);
count += 1;
if (count >= 50) {
sendSyncOffer(node.getNodeId(), bsm);
bsm.getSyncOffer().unsetVersions();
count = 0;
}
}
sendSyncOffer(node.getNodeId(), bsm);
} catch (InterruptedException e) {
// This can't really happen
throw new RuntimeException(e);
} finally {
entries.close();
}
}
}
示例3: antientropy
import org.sdnplatform.sync.internal.store.SynchronizingStorageEngine; //导入方法依赖的package包/类
/**
* Perform a synchronization with the node specified
*/
public void antientropy(Node node) {
if (!rpcService.isConnected(node.getNodeId())) return;
logger.info("[{}->{}] Synchronizing local state to remote node",
getLocalNodeId(), node.getNodeId());
for (SynchronizingStorageEngine store : storeRegistry.values()) {
if (Scope.LOCAL.equals(store.getScope())) {
if (node.getDomainId() !=
getClusterConfig().getNode().getDomainId())
continue;
} else if (Scope.UNSYNCHRONIZED.equals(store.getScope())) {
continue;
}
IClosableIterator<Entry<ByteArray,
List<Versioned<byte[]>>>> entries =
store.entries();
try {
SyncMessage bsm =
TProtocolUtil.getTSyncOfferMessage(store.getName(),
store.getScope(),
store.isPersistent());
int count = 0;
while (entries.hasNext()) {
if (!rpcService.isConnected(node.getNodeId())) return;
Entry<ByteArray, List<Versioned<byte[]>>> pair =
entries.next();
KeyedVersions kv =
TProtocolUtil.getTKeyedVersions(pair.getKey(),
pair.getValue());
bsm.getSyncOffer().addToVersions(kv);
count += 1;
if (count >= 50) {
sendSyncOffer(node.getNodeId(), bsm);
bsm.getSyncOffer().unsetVersions();
count = 0;
}
}
sendSyncOffer(node.getNodeId(), bsm);
} catch (InterruptedException e) {
// This can't really happen
throw new RuntimeException(e);
} finally {
entries.close();
}
}
}