本文整理汇总了Java中org.apache.ignite.internal.util.typedef.internal.U.field方法的典型用法代码示例。如果您正苦于以下问题:Java U.field方法的具体用法?Java U.field怎么用?Java U.field使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.internal.util.typedef.internal.U
的用法示例。
在下文中一共展示了U.field方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: eraseDataFromDisk
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param pageStore Page store.
* @param cacheId Cache id.
* @param page Page.
*/
private void eraseDataFromDisk(
FilePageStoreManager pageStore,
int cacheId,
FullPageId page
) throws IgniteCheckedException, IOException {
PageStore store = pageStore.getStore(
cacheId,
PageIdUtils.partId(page.pageId())
);
FilePageStore filePageStore = (FilePageStore)store;
FileIO fileIO = U.field(filePageStore, "fileIO");
long size = fileIO.size();
fileIO.write(ByteBuffer.allocate((int)size - filePageStore.headerSize()), filePageStore.headerSize());
fileIO.force();
}
示例2: checkCleanState
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Validates clean state on all participating nodes after query cancellation.
*/
@SuppressWarnings("unchecked")
private void checkCleanState() throws IgniteCheckedException {
for (int i = 0; i < GRID_CNT; i++) {
IgniteEx grid = grid(i);
// Validate everything was cleaned up.
ConcurrentMap<UUID, ?> map = U.field(((IgniteH2Indexing)U.field((GridProcessor)U.field(
grid.context(), "qryProc"), "idx")).mapQueryExecutor(), "qryRess");
String msg = "Map executor state is not cleared";
// TODO FIXME Current implementation leaves map entry for each node that's ever executed a query.
for (Object result : map.values()) {
Map<Long, ?> m = U.field(result, "res");
assertEquals(msg, 0, m.size());
}
}
}
开发者ID:apache,项目名称:ignite,代码行数:23,代码来源:IgniteCacheQueryStopOnCancelOrTimeoutDistributedJoinSelfTest.java
示例3: checkCleanState
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Validates clean state on all participating nodes after query cancellation.
*/
@SuppressWarnings("unchecked")
private void checkCleanState() throws IgniteCheckedException {
for (int i = 0; i < GRIDS_CNT; i++) {
IgniteEx grid = grid(i);
// Validate everything was cleaned up.
ConcurrentMap<UUID, ?> map = U.field(((IgniteH2Indexing)U.field((GridProcessor)U.field(
grid.context(), "qryProc"), "idx")).mapQueryExecutor(), "qryRess");
String msg = "Map executor state is not cleared";
// TODO FIXME Current implementation leaves map entry for each node that's ever executed a query.
for (Object result : map.values()) {
Map<Long, ?> m = U.field(result, "res");
assertEquals(msg, 0, m.size());
}
}
}
示例4: checkTypeConfigurations
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
*
* @param nameMapper Name mapper.
* @param idMapper ID mapper.
* @throws IgniteCheckedException If failed.
*/
private void checkTypeConfigurations(BinaryNameMapper nameMapper, BinaryIdMapper idMapper) throws IgniteCheckedException {
BinaryMarshaller marsh = binaryMarshaller(nameMapper, idMapper, Arrays.asList(
new BinaryTypeConfiguration("org.apache.ignite.internal.binary.test.*"),
new BinaryTypeConfiguration("unknown.*")
));
BinaryContext ctx = binaryContext(marsh);
ConcurrentMap<Integer, BinaryInternalMapper> types = U.field(ctx, "typeId2Mapper");
assertEquals(3, types.size());
assertTrue(types.containsKey(typeId(CLASS1_FULL_NAME, nameMapper, idMapper)));
assertTrue(types.containsKey(typeId(CLASS2_FULL_NAME, nameMapper, idMapper)));
assertTrue(types.containsKey(typeId(INNER_CLASS_FULL_NAME, nameMapper, idMapper)));
}
示例5: assertDiscoCacheReuse
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Assert disco cache reuse.
*
* @param v1 First version.
* @param v2 Next version.
*/
private void assertDiscoCacheReuse(AffinityTopologyVersion v1, AffinityTopologyVersion v2) {
for (Ignite ignite : G.allGrids()) {
GridBoundedConcurrentLinkedHashMap<AffinityTopologyVersion, DiscoCache> discoCacheHist =
U.field(((IgniteEx) ignite).context().discovery(), "discoCacheHist");
DiscoCache discoCache1 = discoCacheHist.get(v1);
DiscoCache discoCache2 = discoCacheHist.get(v2);
assertEquals(v1, discoCache1.version());
assertEquals(v2, discoCache2.version());
String[] props = new String[] {
"state", "loc", "rmtNodes", "allNodes", "srvNodes", "daemonNodes", "rmtNodesWithCaches",
"allCacheNodes", "allCacheNodes", "cacheGrpAffNodes", "nodeMap", "minNodeVer"
};
for (String prop : props)
assertSame(U.field(discoCache1, prop), U.field(discoCache2, prop));
assertNotSame(U.field(discoCache1, "alives"), U.field(discoCache2, "alives"));
assertEquals(U.field(discoCache1, "alives"), U.field(discoCache2, "alives"));
}
}
示例6: closeSessions
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param ignite Node.
* @throws Exception If failed.
* @return {@code True} if closed at least one session.
*/
static boolean closeSessions(Ignite ignite) throws Exception {
TcpCommunicationSpi commSpi = (TcpCommunicationSpi)ignite.configuration().getCommunicationSpi();
Map<UUID, GridCommunicationClient[]> clients = U.field(commSpi, "clients");
boolean closed = false;
for (GridCommunicationClient[] clients0 : clients.values()) {
for (GridCommunicationClient client : clients0) {
if (client != null) {
GridTcpNioCommunicationClient client0 = (GridTcpNioCommunicationClient)client;
GridNioSession ses = client0.session();
ses.close();
closed = true;
}
}
}
return closed;
}
示例7: replaceWithCountingMappingRequestListener
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
*
*/
private void replaceWithCountingMappingRequestListener(GridIoManager ioMgr) {
GridMessageListener[] lsnrs = U.field(ioMgr, "sysLsnrs");
final GridMessageListener delegate = lsnrs[GridTopic.TOPIC_METADATA_REQ.ordinal()];
GridMessageListener wrapper = new GridMessageListener() {
@Override public void onMessage(UUID nodeId, Object msg, byte plc) {
metadataReqsCounter.incrementAndGet();
delegate.onMessage(nodeId, msg, plc);
}
};
lsnrs[GridTopic.TOPIC_METADATA_REQ.ordinal()] = wrapper;
}
示例8: messageIndex
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param msgCls Message class to check.
* @return Message index.
*/
private int messageIndex(Class<?> msgCls) {
try {
Integer msgIdx = U.field(msgCls, GridCacheMessage.CACHE_MSG_INDEX_FIELD_NAME);
if (msgIdx == null || msgIdx < 0)
return -1;
return msgIdx;
}
catch (IgniteCheckedException ignored) {
return -1;
}
}
示例9: onDiscovery
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void onDiscovery(
int type,
long topVer,
ClusterNode node,
Collection<ClusterNode> topSnapshot,
@Nullable Map<Long, Collection<ClusterNode>> topHist,
@Nullable DiscoverySpiCustomMessage spiCustomMsg
) {
DiscoveryCustomMessage customMsg = spiCustomMsg == null ? null
: (DiscoveryCustomMessage) U.field(spiCustomMsg, "delegate");
if (customMsg != null) {
//don't want to make this class public, using equality of class name instead of instanceof operator
if ("MappingProposedMessage".equals(customMsg.getClass().getSimpleName())) {
String conflClsName = U.field(customMsg, "conflictingClsName");
if (conflClsName != null && !conflClsName.isEmpty()) {
rejectObserved = true;
if (conflClsName.contains(Aa.class.getSimpleName()))
bbClsRejected = true;
else if (conflClsName.contains(BB.class.getSimpleName()))
aaClsRejected = true;
}
}
}
if (delegate != null)
delegate.onDiscovery(type, topVer, node, topSnapshot, topHist, spiCustomMsg);
}
示例10: onExchange
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void onExchange(DiscoveryDataPacket dataPacket, ClassLoader clsLdr) {
if (locNode.isClient()) {
Map<Integer, byte[]> cmnData = U.field(dataPacket, "commonData");
cmnData.remove(GridComponent.DiscoveryDataExchangeType.MARSHALLER_PROC.ordinal());
}
super.onExchange(dataPacket, clsLdr);
}
示例11: binaryContext
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param marsh Marshaller.
* @return Binary context.
*/
protected BinaryContext binaryContext(BinaryMarshaller marsh) {
GridBinaryMarshaller impl = U.field(marsh, "impl");
return impl.context();
}
示例12: binaryContext
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @return Binary context.
* @throws IgniteCheckedException if failed.
*/
private BinaryContext binaryContext() throws IgniteCheckedException {
GridBinaryMarshaller impl = U.field(binaryMarshaller(), "impl");
return impl.context();
}
示例13: testStaticCacheStartAfterActivationWithCacheFilter
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @throws Exception if fail.
*/
public void testStaticCacheStartAfterActivationWithCacheFilter() throws Exception {
String cache1 = "cache1";
String cache2 = "cache2";
String cache3 = "cache3";
IgniteConfiguration cfg1 = getConfiguration("node1");
cfg1.setCacheConfiguration(
new CacheConfiguration(cache1).setNodeFilter(new NodeFilterIgnoreByName("node2")));
IgniteConfiguration cfg2 = getConfiguration("node2");
cfg2.setCacheConfiguration(
new CacheConfiguration(cache2).setNodeFilter(new NodeFilterIgnoreByName("node3")));
IgniteConfiguration cfg3 = getConfiguration("node3");
cfg3.setCacheConfiguration(
new CacheConfiguration(cache3).setNodeFilter(new NodeFilterIgnoreByName("node1")));
IgniteEx ig1 = startGrid(cfg1);
IgniteEx ig2 = startGrid(cfg2);
IgniteEx ig3 = startGrid(cfg3);
assertTrue(!ig1.active());
assertTrue(!ig2.active());
assertTrue(!ig3.active());
ig3.active(true);
assertTrue(ig1.active());
assertTrue(ig2.active());
assertTrue(ig3.active());
for (IgniteEx ig : Arrays.asList(ig1, ig2, ig3)) {
Map<String, DynamicCacheDescriptor> desc = U.field(
(Object)U.field(ig.context().cache(), "cachesInfo"), "registeredCaches");
assertEquals(4, desc.size());
Map<String, GridCacheAdapter<?, ?>> caches = U.field(ig.context().cache(), "caches");
assertEquals(3, caches.keySet().size());
}
Map<String, GridCacheAdapter<?, ?>> caches1 = U.field(ig1.context().cache(), "caches");
Assert.assertNotNull(caches1.get(cache1));
Assert.assertNotNull(caches1.get(cache2));
Assert.assertNull(caches1.get(cache3));
Map<String, GridCacheAdapter<?, ?>> caches2 = U.field(ig2.context().cache(), "caches");
Assert.assertNull(caches2.get(cache1));
Assert.assertNotNull(caches2.get(cache2));
Assert.assertNotNull(caches2.get(cache3));
Map<String, GridCacheAdapter<?, ?>> caches3 = U.field(ig3.context().cache(), "caches");
Assert.assertNotNull(caches3.get(cache1));
Assert.assertNull(caches3.get(cache2));
Assert.assertNotNull(caches3.get(cache3));
}
示例14: testStartDynamicCachesAfterActivation
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @throws Exception if fail.
*/
public void testStartDynamicCachesAfterActivation() throws Exception {
final String cacheName0 = "cache0";
final String cacheName = "cache";
IgniteConfiguration cfg1 = getConfiguration("serv1");
IgniteConfiguration cfg2 = getConfiguration("serv2");
IgniteConfiguration cfg3 = getConfiguration("client");
cfg3.setCacheConfiguration(new CacheConfiguration(cacheName0));
cfg3.setClientMode(true);
IgniteEx ig1 = startGrid(cfg1);
IgniteEx ig2 = startGrid(cfg2);
IgniteEx ig3 = startGrid(cfg3);
assertTrue(!ig1.active());
assertTrue(!ig2.active());
assertTrue(!ig3.active());
ig3.active(true);
assertTrue(ig1.active());
assertTrue(ig2.active());
assertTrue(ig3.active());
ig3.createCache(new CacheConfiguration<>(cacheName));
assertNotNull(ig3.cache(cacheName));
assertNotNull(ig1.cache(cacheName));
assertNotNull(ig2.cache(cacheName));
assertNotNull(ig1.cache(cacheName0));
assertNotNull(ig3.cache(cacheName0));
assertNotNull(ig2.cache(cacheName0));
ig3.active(false);
assertTrue(!ig1.active());
assertTrue(!ig2.active());
assertTrue(!ig3.active());
ig3.active(true);
assertTrue(ig1.active());
assertTrue(ig2.active());
assertTrue(ig3.active());
assertNotNull(ig1.cache(cacheName));
assertNotNull(ig2.cache(cacheName));
Map<String, GridCacheAdapter<?, ?>> caches = U.field(ig3.context().cache(), "caches");
// Only system cache and cache0
assertEquals("Unexpected caches: " + caches.keySet(), 3, caches.size());
assertTrue(caches.containsKey(CU.UTILITY_CACHE_NAME));
assertTrue(caches.containsKey(cacheName0));
assertTrue(caches.containsKey(cacheName));
assertNotNull(ig3.cache(cacheName));
}
示例15: checkOverflow
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @throws Exception If failed.
*/
@SuppressWarnings("unchecked")
private void checkOverflow() throws Exception {
TcpCommunicationSpi spi0 = spis.get(0);
TcpCommunicationSpi spi1 = spis.get(1);
ClusterNode node0 = nodes.get(0);
ClusterNode node1 = nodes.get(1);
final GridNioServer srv1 = U.field(spi1, "nioSrvr");
int msgId = 0;
// Send message to establish connection.
spi0.sendMessage(node1, new GridTestMessage(node0.id(), ++msgId, 0));
// Prevent node1 from send
GridTestUtils.setFieldValue(srv1, "skipWrite", true);
final GridNioSession ses0 = communicationSession(spi0);
int sentMsgs = 1;
for (int i = 0; i < 1280; i++) {
try {
spi0.sendMessage(node1, new GridTestMessage(node0.id(), ++msgId, 0));
sentMsgs++;
}
catch (IgniteSpiException e) {
log.info("Send error [err=" + e + ", sentMsgs=" + sentMsgs + ']');
break;
}
}
// Wait when session is closed because of queue overflow.
GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
return ses0.closeTime() != 0;
}
}, 5000);
assertTrue("Failed to wait for session close", ses0.closeTime() != 0);
GridTestUtils.setFieldValue(srv1, "skipWrite", false);
for (int i = 0; i < 100; i++)
spi0.sendMessage(node1, new GridTestMessage(node0.id(), ++msgId, 0));
final int expMsgs = sentMsgs + 100;
final TestListener lsnr = (TestListener)spi1.getListener();
GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
return lsnr.rcvCnt.get() >= expMsgs;
}
}, 5000);
assertEquals(expMsgs, lsnr.rcvCnt.get());
}