- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我们对使用 jackrabbit 的应用程序进行了一些性能测试之后,我们面临着并发修改 jackrabbit 存储库的巨大问题。当我们在多线程模拟中添加节点或编辑节点时,就会出现问题。然后我编写了非常简单的测试,这表明问题不在我们的环境中。
就是这样:
简单的无状态Bean
@Stateless @Local(TestFacadeLocal.class) @Remote(TestFacadeRemote.class) public class TestFacadeBean implements TestFacadeRemote, TestFacadeLocal { public void doAction(int name) throws Exception { new TestSynch().doAction(name); } }
简单类
public class TestSynch { public void doAction(int name) throws Exception { Session session = ((Repository) new InitialContext(). lookup("java:jcr/local")).login( new SimpleCredentials("username", "pwd".toCharArray())); List added = new ArrayList(); Node folder = session.getRootNode().getNode("test"); for (int i = 0; i <= 100; i++) { Node child = folder.addNode("" + System.currentTimeMillis(), "nt:folder"); child.addMixin("mix:versionable"); added.add(child); } // saving butch changes session.save(); //checking in all created nodes for (Node node : added) { session.getWorkspace().getVersionManager().checkin(node.getPath()); } } }
和测试类
public class Test { private int c = 0; private int countAll = 50; private ExecutorService executor = Executors.newFixedThreadPool(5); public ExecutorService getExecutor() { return executor; } public static void main(String[] args) { Test test = new Test(); try { test.start(); } catch (Exception e) { e.printStackTrace(); } } private void start() throws Exception { long time = System.currentTimeMillis(); TestFacadeRemote testBean = (TestFacadeRemote) getContext(). lookup( "test/TestFacadeBean/remote"); for (int i = 0; i < countAll; i++) { getExecutor().execute(new TestInstallerThread(i, testBean)); } getExecutor().shutdown(); while (!getExecutor().isTerminated()) { try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } } System.out.println(c + " shutdown " + (System.currentTimeMillis() - time)); } class TestInstallerThread implements Runnable { private int number = 0; TestFacadeRemote testBean; public TestInstallerThread(int number, TestFacadeRemote testBean) { this.number = number; this.testBean = testBean; } @Override public void run() { try { System.out.println("Installing data " + number); testBean.doAction(number); System.out.println("STOP" + number); } catch (Exception e) { e.printStackTrace(); c++; } } } public Context getContext() throws NamingException { Properties properties = new Properties(); //init props .............. return new InitialContext(properties); } }
如果我使用池中的 1 个线程初始化执行程序,则所有操作均已完成,没有任何错误。如果我用 5 个线程初始化执行程序,有时会出现错误:
在客户端
java.lang.RuntimeException: javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state at org.jboss.aspects.tx.TxPolicy.handleEndTransactionException(TxPolicy.java:198)
在服务器上开始警告
ItemStateReferenceCache [ItemStateReferenceCache.java:176] overwriting cached entry 187554a7-4c41-404b-b6ee-3ce2a9796a70
然后
javax.jcr.RepositoryException: org.apache.jackrabbit.core.state.ItemStateException: there's already a property state instance with id 52fb4b2c-3ef4-4fc5-9b79-f20a6b2e9ea3/{http://www.jcp.org/jcr/1.0}created at org.apache.jackrabbit.core.PropertyImpl.restoreTransient(PropertyImpl.java:195) ~[jackrabbit-core-2.2.7.jar:2.2.7] at org.apache.jackrabbit.core.ItemSaveOperation.restoreTransientItems(ItemSaveOperation.java:879) [jackrabbit-core-2.2.7.jar:2.2.7]
我们尝试同步此方法和其他工作流程,以将多线程调用作为一个线程处理。没有任何帮助。
还有一件事 - 当我们在没有 ejb 层的情况下进行类似的测试时 - 一切都工作正常。看起来就像容器包装在自己的事务中,然后全部崩溃。
也许有人遇到过这样的问题。提前致谢。
最佳答案
来自Jackrabbit Wiki :
The JCR specification explicitly states that a Session is not thread-safe (JCR 1.0 section 7.5 and JCR 2.0 section 4.1.2). Hence, Jackrabbit does not support multiple threads concurrently reading from or writing to the same session. Each session should only ever be accessed from one thread.
...If you need to write to the same node concurrently, then you need to use multiple sessions, and use JCR locking to ensure there is no conflict.
关于multithreading - Jackrabbit 和并发修改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6680237/
任何人都知道如何将内容从一个 Magnolia CMS 存储库(Jackrabbit 存储库)传输/迁移到我们的应用程序使用的另一个自定义 jacrabbit 存储库? 最佳答案 正如另一张海报所建议
我们只使用 Jackrabbit 来存储文件,我们稍后会使用它们的完整路径或 UUID 来检索这些文件。在这种情况下关闭 Jackrabbit 索引是否安全? Jackrabbit XPath 查询呢
我有两个包含相同内容的 Jackrabbit 实例。重建 Lucene 索引很慢,30+ 小时,集群中需要的停机时间是有风险的。是否可以只重新索引一个 Jackrabbit,然后将 Lucene 索引
如果这听起来很愚蠢,我很抱歉,但是 Jackrabbit 和 Oak 之间有什么区别?我正在研究 JCR170,特别是如何在两个 jackrabbit 安装之间迁移内容,我遇到了 JackRabbit
在您的应用程序中将 Apache Jackrabbit JCR 作为嵌入式服务运行时,是否有一种快速的方法可以在不关闭 Jackrabbit 的情况下对 Jackrabbit 存储库的内容进行可靠且一
一旦节点被删除,您如何找到它以便您可以使用 jackrabbit 或 jcr API 恢复它? 最佳答案 我不是 Jackrabbit 版本控制方面的专家,但据我所知,除非您知道其中的一些数据,否则没
在我的项目中,我需要将 Jackrabbit 1.3 更改为 Jackrabbit 2.1.1。我的工作是为查询工作。如果索引格式和查询格式有变化,请建议我。 Jackrabbit 2.1.1 使用
如果我明白了,Apache Sling 会为 Jackrabbit JCR 存储库充当 REST CRUD 接口(interface)。 由于已经存在 RESTful 协议(protocol)(其 A
我已经使用 jackrabbit-standalone-2.4.2.jar 创建了一个代码,并且在项目目录中获取了 jackrabbit.log_IS_UNDEFINED.log 文件。该日志文件非常
我尝试使用 Jackrabbit 和 Oracle DB 作为持久层。因此,我在 Tomcat 6 服务器(本地)上安装了 Jackrabbit。数据库在虚拟机中运行。从 Jackrabbits 项目
我在 Jackrabbit 存储库中标记了对象(实际上是 Adobe/Day CQ 的 CRX,但我认为这是 Jackrabbit 代码): Assets :标签 = A、B 子 Assets 数
我有一个基于文件系统的Jackrabbit存储库,我想直接查看和编辑。是否有一个允许我直接查看/编辑/删除/添加节点的工具? 最佳答案 Jackrabbit本身目前没有内置的通用JCR资源管理器,但是
我正在将海量数据导入JackRabbit JCR存储库。一个好的可视化JCR存储库的UI管理工具将非常适合检查导入的数据是否布局正确,也将使我作为开发人员的生活更加轻松。 最佳答案 我是JCR Con
我想在集群中设置 Jackrabbit(我正在用 Liferay 设置它)。 我阅读了这份文件 - http://wiki.apache.org/jackrabbit/Clustering ,不幸的是
我遇到了一个问题,即由于一次有超过 1000 个访问控制条目处于事件状态,许多进程被阻塞;这是known issue in Jackrabbit ;已确定解决方法并将其推出到 2.4.1 中,但 CQ
我已经向 jackrabbit 用户列表发送了相同的消息,但没有人回复我。 我想使用 Jackrabbit 2.4.3 更新一个节点及其子节点,抛出 jackrabbit-jcr2dav。 (就像合并
在我们对使用 jackrabbit 的应用程序进行了一些性能测试之后,我们面临着并发修改 jackrabbit 存储库的巨大问题。当我们在多线程模拟中添加节点或编辑节点时,就会出现问题。然后我编写了非
我目前正在建立一个 Liferay 门户实例。 Liferay 使用 Jackrabbit 作为其文档存储库管理系统。要配置 Jackrabbit,我必须将数据库访问 URL、用户名和密码放入repo
有人可以提供一个集成 spring 3 和 jackrabbit 2.5 的例子吗?如果您可以在示例中提供 spring 配置 (applicationContext.xml) 和 jackrabbi
我的应用程序使用独立版本的 jackrabbit,我们想转移到嵌入式模式以便我们可以对其进行集群。 我阅读了 jackrabbit 集群站点上的要求,但仍然感到困惑。我应该为每个集群节点设置不同的主目
我是一名优秀的程序员,十分优秀!