- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在运行与 ignite CacheEvents 程序相关的 github 示例时,没有得到任何输出(示例链接:https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheEventsExample.java)。任何人都可以帮助我吗?
示例:
package com.example;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.util.UUID;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteException;
import org.apache.ignite.Ignition;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.CacheEvent;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgnitePredicate;
import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT;
import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ;
import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED;
/**
* This examples demonstrates events API. Note that ignite events are disabled by default and
* must be specifically enabled, just like in {@code examples/config/example-ignite.xml} file.
* <p>
* Remote nodes should always be started with special configuration file which
* enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
* <p>
* Alternatively you can run {@link ExampleNodeStartup} in another JVM which will
* start node with {@code examples/config/example-ignite.xml} configuration.
*/
public class CacheEventsExample {
/** Cache name. */
private static final String CACHE_NAME = "CACHE";
Ignite ignite ;
/**
* Executes example.
*
* @param args Command line arguments, none required.
* @throws IgniteException If example execution failed.
*/
public static void main(String[] args) throws IgniteException, InterruptedException {
/*s*/
final Ignite ignite = Ignition.start();
try {
System.out.println();
System.out.println(">>> Cache events example started.");
// Auto-close cache at the end of the example.
IgniteCache<Integer, String> cache = ignite.getOrCreateCache(CACHE_NAME);
System.out.println(" after cache create ");
// This optional local callback is called for each event notification
// that passed remote predicate listener.
IgniteBiPredicate<UUID, CacheEvent> locLsnr = new IgniteBiPredicate<UUID, CacheEvent>() {
@Override public boolean apply(UUID uuid, CacheEvent evt) {
System.out.println("Received event [evt=" + evt.name() + ", key=" + evt.key() +
", oldVal=" + evt.oldValue() + ", newVal=" + evt.newValue());
return true; // Continue listening.
}
};
System.out.println(" after local listener");
// Remote listener which only accepts events for keys that are
// greater or equal than 10 and if event node is primary for this key.
IgnitePredicate<CacheEvent> rmtLsnr = new IgnitePredicate<CacheEvent>() {
@Override public boolean apply(CacheEvent evt) {
System.out.println("ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ ");
System.out.println("Cache event [name=" + evt.name() + ", key=" + evt.key() + ']');
int key = evt.key();
return key >= 10 && ignite.affinity(CACHE_NAME).isPrimary(ignite.cluster().localNode(), key);
}
};
System.out.println(" After remote listener ");
// Subscribe to specified cache events on all nodes that have cache running.
// Cache events are explicitly enabled in examples/config/example-ignite.xml file.
ignite.events(ignite.cluster().forCacheNodes(CACHE_NAME)).remoteListen(locLsnr, rmtLsnr,
EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_READ, EVT_CACHE_OBJECT_REMOVED);
// Generate cache events.
for (int i = 0; i < 20; i++){
System.out.println(" insert data into cache "+i);
cache.put(i, Integer.toString(i));
}
// Wait for a while while callback is notified about remaining puts.
Thread.sleep(2000);
}catch(Exception e){
System.out.println("ERRRROR : "+e);
}
}
}
运行上述示例时生成的日志:
>>> ver. 2.1.0#20170720-sha1:a6ca5c8a
>>> 2017 Copyright(C) Apache Software Foundation
>>>
>>> Ignite documentation: http://ignite.apache.org
[2017-08-02 13:52:27,940][INFO ][main][IgniteKernal] Config URL: n/a
[2017-08-02 13:52:27,940][INFO ][main][IgniteKernal] Daemon mode: off
[2017-08-02 13:52:27,940][INFO ][main][IgniteKernal] OS: Linux 4.2.0-42-
generic amd64
[2017-08-02 13:52:27,940][INFO ][main][IgniteKernal] OS user: developers
[2017-08-02 13:52:27,942][INFO ][main][IgniteKernal] PID: 1343
[2017-08-02 13:52:27,942][INFO ][main][IgniteKernal] Language runtime: Java Platform API Specification ver. 1.7
[2017-08-02 13:52:27,943][INFO ][main][IgniteKernal] VM information: OpenJDK Runtime Environment 1.7.0_131-b00 Oracle Corporation OpenJDK 64-Bit Server VM 24.131-b00
[2017-08-02 13:52:27,944][INFO ][main][IgniteKernal] VM total memory: 1.7GB
[2017-08-02 13:52:27,944][INFO ][main][IgniteKernal] Remote Management [restart: off, REST: on, JMX (remote: off)]
[2017-08-02 13:52:27,944][INFO ][main][IgniteKernal] IGNITE_HOME=null
[2017-08-02 13:52:27,944][INFO ][main][IgniteKernal] VM arguments: [-DIGNITE_QUIET=false, -Dfile.encoding=UTF-8]
[2017-08-02 13:52:27,944][INFO ][main][IgniteKernal] System cache's MemoryPolicy size is configured to 40 MB. Use MemoryConfiguration.systemCacheMemorySize property to change the setting.
[2017-08-02 13:52:27,944][INFO ][main][IgniteKernal] Configured caches [in 'sysMemPlc' memoryPolicy: ['ignite-sys-cache', 'ignite-hadoop-mr-sys-cache']]
[2017-08-02 13:52:27,955][WARN ][pub-#14%null%][GridDiagnostic] Initial heap size is 123MB (should be no less than 512MB, use -Xms512m -Xmx512m).
[2017-08-02 13:52:28,080][INFO ][main][IgnitePluginProcessor] Configured plugins:
[2017-08-02 13:52:28,080][INFO ][main][IgnitePluginProcessor] ^-- None
[2017-08-02 13:52:28,080][INFO ][main][IgnitePluginProcessor]
[2017-08-02 13:52:28,142][INFO ][main][TcpCommunicationSpi] Successfully bound communication NIO server to TCP port [port=47100, locHost=0.0.0.0/0.0.0.0, selectorsCnt=4, selectorSpins=0, pairedConn=false]
[2017-08-02 13:52:28,150][WARN ][main][TcpCommunicationSpi] Message queue limit is set to 0 which may lead to potential OOMEs when running cache operations in FULL_ASYNC or PRIMARY_SYNC modes due to message queues growth on sender and receiver sides.
[2017-08-02 13:52:28,180][WARN ][main][NoopCheckpointSpi] Checkpoints are disabled (to enable configure any GridCheckpointSpi implementation)
[2017-08-02 13:52:28,216][WARN ][main][GridCollisionManager] Collision resolution is disabled (all jobs will be activated upon arrival).
[2017-08-02 13:52:28,217][INFO ][main][IgniteKernal] Security status [authentication=off, tls/ssl=off]
Aug 02, 2017 1:52:28 PM java.util.logging.LogManager$RootLogger log
SEVERE: Failed to resolve default logging config file: config/java.util.logging.properties
[2017-08-02 13:52:28,564][INFO ][main][SqlListenerProcessor] SQL connector processor has started on TCP port 10800
[2017-08-02 13:52:28,621][INFO ][main][GridTcpRestProtocol] Command protocol successfully started [name=TCP binary, host=0.0.0.0/0.0.0.0, port=11211]
[2017-08-02 13:52:28,888][INFO ][main][GridJettyRestProtocol] Command protocol successfully started [name=Jetty REST, host=/0.0.0.0, port=8080]
[2017-08-02 13:52:28,917][WARN ][main][IgniteKernal] Hadoop module will not start due to exception: Failed to resolve Hadoop classpath (please define HADOOP_HOME environment variable and point it to your Hadoop distribution).
[2017-08-02 13:52:28,938][INFO ][main][IgniteKernal] Non-loopback local IPs: 00.00.00.00, fe80:0:0:0:42b0:34ff:febf:6fe%2
[2017-08-02 13:52:28,938][INFO ][main][IgniteKernal] Enabled local MACs: 40B034BF06FE
[2017-08-02 13:52:28,985][INFO ][main][TcpDiscoverySpi] Successfully bound to TCP port [port=47500, localHost=0.0.0.0/0.0.0.0, locNodeId=ee678636-f45e-4c8a-856d-c339fef7a29c]
[2017-08-02 13:52:28,990][WARN ][main][TcpDiscoveryMulticastIpFinder] TcpDiscoveryMulticastIpFinder has no pre-configured addresses (it is recommended in production to specify at least one address in TcpDiscoveryMulticastIpFinder.getAddresses() configuration property)
[2017-08-02 13:52:30,269][INFO ][exchange-worker-#34%null%][time] Started exchange init [topVer=AffinityTopologyVersion [topVer=1, minorTopVer=0], crd=true, evt=10, node=TcpDiscoveryNode [id=ee678636-f45e-4c8a-856d-c339fef7a29c, addrs=[0:0:0:0:0:0:0:1%1, 00.00.00.00, 127.0.0.1], sockAddrs=[/00.00.00.00:47500, /127.0.0.1:47500, /0:0:0:0:0:0:0:1%1:47500], discPort=47500, order=1, intOrder=1, lastExchangeTime=1501662148985, loc=true, ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=false], evtNode=TcpDiscoveryNode [id=ee678636-f45e-4c8a-856d-c339fef7a29c, addrs=[0:0:0:0:0:0:0:1%1, 00.00.00.00, 127.0.0.1], sockAddrs=[/00.00.00.00:47500, /127.0.0.1:47500, /0:0:0:0:0:0:0:1%1:47500], discPort=47500, order=1, intOrder=1, lastExchangeTime=1501662148985, loc=true, ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=false], customEvt=null]
[2017-08-02 13:52:30,276][WARN ][exchange-worker-#34%null%][IgniteCacheDatabaseSharedManager] No user-defined default MemoryPolicy found; system default of 1GB size will be used.
[2017-08-02 13:52:30,576][INFO ][exchange-worker-#34%null%][GridCacheProcessor] Started cache [name=ignite-sys-cache, memoryPolicyName=sysMemPlc, mode=REPLICATED, atomicity=TRANSACTIONAL]
[2017-08-02 13:52:30,579][INFO ][exchange-worker-#34%null%][GridCacheProcessor] Started cache [name=ignite-hadoop-mr-sys-cache, memoryPolicyName=sysMemPlc, mode=REPLICATED, atomicity=TRANSACTIONAL]
[2017-08-02 13:52:30,606][INFO ][exchange-worker-#34%null%][GridDhtPartitionsExchangeFuture] Finished waiting for partition release future [topVer=AffinityTopologyVersion [topVer=1, minorTopVer=0], waitTime=0ms]
[2017-08-02 13:52:30,687][INFO ][exchange-worker-#34%null%][GridDhtPartitionsExchangeFuture] Snapshot initialization completed [topVer=AffinityTopologyVersion [topVer=1, minorTopVer=0], time=0ms]
[2017-08-02 13:52:30,700][INFO ][exchange-worker-#34%null%][time] Finished exchange init [topVer=AffinityTopologyVersion [topVer=1, minorTopVer=0], crd=true]
[2017-08-02 13:52:30,707][INFO ][exchange-worker-#34%null%][GridCachePartitionExchangeManager] Skipping rebalancing (nothing scheduled) [top=AffinityTopologyVersion [topVer=1, minorTopVer=0], evt=NODE_JOINED, node=ee678636-f45e-4c8a-856d-c339fef7a29c]
[2017-08-02 13:52:30,783][INFO ][main][IgniteKernal] Performance suggestions for grid (fix if possible)
[2017-08-02 13:52:30,783][INFO ][main][IgniteKernal] To disable, set -DIGNITE_PERFORMANCE_SUGGESTIONS_DISABLED=true
[2017-08-02 13:52:30,783][INFO ][main][IgniteKernal] ^-- Switch to the most recent 1.8 JVM version
[2017-08-02 13:52:30,783][INFO ][main][IgniteKernal] ^-- Specify JVM heap max size (add '-Xmx<size>[g|G|m|M|k|K]' to JVM options)
[2017-08-02 13:52:30,784][INFO ][main][IgniteKernal] ^-- Set max direct memory size if getting 'OOME: Direct buffer memory' (add '-XX:MaxDirectMemorySize=<size>[g|G|m|M|k|K]' to JVM options)
[2017-08-02 13:52:30,784][INFO ][main][IgniteKernal] ^-- Disable processing of calls to System.gc() (add '-XX:+DisableExplicitGC' to JVM options)
[2017-08-02 13:52:30,784][INFO ][main][IgniteKernal] Refer to this page for more performance suggestions: https://apacheignite.readme.io/docs/jvm-and-system-tuning
[2017-08-02 13:52:30,784][INFO ][main][IgniteKernal]
[2017-08-02 13:52:30,784][INFO ][main][IgniteKernal] To start Console Management & Monitoring run ignitevisorcmd.{sh|bat}
[2017-08-02 13:52:30,784][INFO ][main][IgniteKernal]
[2017-08-02 13:52:30,785][INFO ][main][IgniteKernal]
>>> +----------------------------------------------------------------------+
>>> Ignite ver. 2.1.0#20170720-sha1:a6ca5c8a97e9a4c9d73d40ce76d1504c14ba1940
>>> +----------------------------------------------------------------------+
>>> OS name: Linux 4.2.0-42-generic amd64
>>> CPU(s): 4
>>> Heap: 1.7GB
>>> VM name: 1343@localhost
>>> Local node [ID=EE678636-F45E-4C8A-856D-C339FEF7A29C, order=1, clientMode=false]
>>> Local node addresses: [00.00.00.00/0:0:0:0:0:0:0:1%1, /00.00.00.00, /127.0.0.1]
>>> Local ports: TCP:8080 TCP:10800 TCP:11211 TCP:47100 UDP:47400 TCP:47500
[2017-08-02 13:52:30,786][INFO ][main][GridDiscoveryManager] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=1.7GB]
>>> Cache events example started.
[2017-08-02 13:52:30,802][INFO ][exchange-worker-#34%null%][time] Started exchange init [topVer=AffinityTopologyVersion [topVer=1, minorTopVer=1], crd=true, evt=18, node=TcpDiscoveryNode [id=ee678636-f45e-4c8a-856d-c339fef7a29c, addrs=[0:0:0:0:0:0:0:1%1, 00.00.00.00, 127.0.0.1], sockAddrs=[/00.00.00.00:47500, /127.0.0.1:47500, /0:0:0:0:0:0:0:1%1:47500], discPort=47500, order=1, intOrder=1, lastExchangeTime=1501662148985, loc=true, ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=false], evtNode=TcpDiscoveryNode [id=ee678636-f45e-4c8a-856d-c339fef7a29c, addrs=[0:0:0:0:0:0:0:1%1, 00.00.00.00, 127.0.0.1], sockAddrs=[/00.00.00.00:47500, /127.0.0.1:47500, /0:0:0:0:0:0:0:1%1:47500], discPort=47500, order=1, intOrder=1, lastExchangeTime=1501662148985, loc=true, ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=false], customEvt=DynamicCacheChangeBatch [id=0d3f902ad51-474b0be6-3ed8-4797-9c9e-9a2166009164, reqs=[DynamicCacheChangeRequest [cacheName=CACHE, hasCfg=true, nodeId=ee678636-f45e-4c8a-856d-c339fef7a29c, clientStartOnly=false, stop=false, destroy=false]], exchangeActions=ExchangeActions [startCaches=[CACHE], stopCaches=null, startGrps=[CACHE], stopGrps=[], resetParts=null, stateChangeRequest=null], startCaches=false]]
[2017-08-02 13:52:30,844][INFO ][exchange-worker-#34%null%][GridCacheProcessor] Started cache [name=CACHE, memoryPolicyName=default, mode=PARTITIONED, atomicity=ATOMIC]
[2017-08-02 13:52:30,846][INFO ][exchange-worker-#34%null%][GridDhtPartitionsExchangeFuture] Finished waiting for partition release future [topVer=AffinityTopologyVersion [topVer=1, minorTopVer=1], waitTime=0ms]
[2017-08-02 13:52:30,963][INFO ][exchange-worker-#34%null%][GridDhtPartitionsExchangeFuture] Snapshot initialization completed [topVer=AffinityTopologyVersion [topVer=1, minorTopVer=1], time=0ms]
after cache create
[2017-08-02 13:52:30,964][INFO ][exchange-worker-#34%null%][time] Finished exchange init [topVer=AffinityTopologyVersion [topVer=1, minorTopVer=1], crd=true]
after local listener
After remote listener
[2017-08-02 13:52:30,975][INFO ][exchange-worker-#34%null%][GridCachePartitionExchangeManager] Skipping rebalancing (nothing scheduled) [top=AffinityTopologyVersion [topVer=1, minorTopVer=1], evt=DISCOVERY_CUSTOM_EVT, node=ee678636-f45e-4c8a-856d-c339fef7a29c]
[2017-08-02 13:52:30,979][WARN ][main][GridEventStorageManager] Added listener for disabled event type: CACHE_OBJECT_PUT
[2017-08-02 13:52:30,979][WARN ][main][GridEventStorageManager] Added listener for disabled event type: CACHE_OBJECT_READ
[2017-08-02 13:52:30,979][WARN ][main][GridEventStorageManager] Added listener for disabled event type: CACHE_OBJECT_REMOVED
最佳答案
您使用默认配置 xml 文件启动了 Ignite。默认情况下,所有事件都被禁用,必须专门启用。因此,使用“examples/config/example-ignite.xml”启动 Ignite,就像您更改之前的示例一样:
Ignite ignite = Ignition.start("examples/config/example-ignite.xml")
或者,您可以创建自己的配置并在其中启用某些事件:
<property name="includeEventTypes">
<list>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED"/>
</list>
</property>
关于java - 在 java 中运行 github Apache Ignite 事件示例时没有得到任何输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45430956/
你好 StackOverflow。 我在 Github 上遇到了一个奇怪的错误。 存储库 Link 我在 4 个月前创建了一个存储库。并且只向该存储库添加了 2 个贡献者。 • 我没有再添加贡献者但是
我已经配置了 Jenkins Github 拉取请求构建器插件来构建我机构成员提出的每个拉取请求。它就像一个魅力。 但是,构建并没有像在这个不错的 post 中显示的那样将构建状态报告回 github
我只是想知道在任何 GitHub 源代码查看页面上可以查看多少个字符而不会溢出(水平滚动)。 最佳答案 在 OS X v10.9 (小牛队): 谷歌浏览器:125 火狐:122 Safari :121
我一直在寻找可以进入 .github 的事物的零碎示例。 GitHub 存储库上的目录。 我可以看到它用于 GitHub 操作和工作流以及拉取请求和问题模板,但我看不到一个页面,其中概述了您可以在理想
尝试运行 --is-bare-repository 命令,但意识到在我的克隆副本上运行它是不正确的。有没有办法在实际的 GitHub 存储库上使用相同的命令?存储库也没有显示 .git 文件。请原谅我
我正在使用 github 页面和 jekyll 创建一个博客。我想知道是否有一种方法可以将 github 文件(即存储库中的文件)中的代码片段嵌入到博客文章中。我可以在此页面上找到有关嵌入要点的解决方
我在 GitHub 存储库中有一个文件,需要通过运行命令偶尔更新。 作为 GitHub Workflows 的一部分,我想让一个机器人运行一个命令,并查看它是否在 repo 上创建了一个差异,如果是,
尝试从 Github 桌面应用程序发布到 github.com 时出现以下错误。 GitHub Desktop was unable to store the account token in the
类似于Desktop notifications from GitHub (从 10 年前开始)但提出了一个稍微不同的问题 - GitHub 是否支持 web notifications ?我想知道关
我想使用 semantic-release 在 Github 版本上发布整个目录(构建目录),但不幸的是它将每个构建文件作为单个 Assets 发布。 用于复制: 我正在使用 Vue CLI 生成一个
这让我发疯,我知道这听起来像是一个愚蠢的问题,但我已经为此苦苦挣扎了 2 天。我刚刚完成了 Visual Code 的编码,我想将它推送到 github 上。所以我创建了一个名为 mern-maps
在 GitHub 上,一个用户可以属于多个组织。一个存储库是否也可以成为多个组织的一部分? 最佳答案 根据 this blog post by GitHub , 一个仓库只能属于一个组织。 Creat
在 GitHub 操作中,我使用脚本创建了一个文件。然后我可以使用 git 创建一个分支,添加文件,提交文件并将分支推送到 repo。全部使用 git。 然后我想从我的操作中创建一个 PR,所以我使用
在 GitHub 中,当我转到:[Insights] - [Networks] 时,我看到我的分支有不同的颜色。有些在 blue , 其他人在 green .我找不到解释。 有谁知道不同颜色是什么意思
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
我只是在尝试 GitHub。 为什么有些提交显示为“一天前在 GitHub 上提交”而其他提交显示为“一天前提交”? 例如这里: https://github.com/apple/swift/comm
有没有办法更改 Github 上的配色方案以进行语法高亮显示?我已经进行了基本搜索,但找不到答案。 最佳答案 目前没有办法改变服务器端的配色方案。 github.com 的几个用户已经要求 自定义语法
Github 上关闭的拉取请求是否意味着拉取请求未合并? 如果没有,有没有办法确定已关闭的拉取请求是否已合并? 谢谢。 最佳答案 If no, is there a way I can determi
不确定这是否与主题无关,但我真的很好奇这种类型的图表是否有名称以及如何创建。 像这样:https://help.github.com/articles/viewing-contributions-on
GitHub 中合作者和贡献者的拉取请求有什么区别?我没有发现合作者有任何特殊特权。 最佳答案 合作者对贡献者的一项特权是......他们(合作者)可以直接推送到您的存储库(因为您拥有 added t
我是一名优秀的程序员,十分优秀!