远程API,Objectify和DevServer不喜欢交易? [英] Remote API, Objectify and the DevServer don't like transactions?

查看:140
本文介绍了远程API,Objectify和DevServer不喜欢交易?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用objectify 4来写入HRD数据存储。在单元测试中运行正常,并在devserver或production中运行应用程序。



但是,当我尝试使用REMOTE API连接到devserver数据存储区时,代码启动XG事务。在与Remote API连接时,似乎认为HRD未启用。
这就是我连接的方式...

pre $ public c om public static void main(String [] args){
RemoteApiOptions options = new RemoteApiOptions()。server(localhost,8888).credentials(foo,bar);
//选项=选项。
RemoteApiInstaller安装程序=新的RemoteApiInstaller();
StoredUser storedUser = null;
尝试{
installer.install(options);
ObjectifyInitializer.register();
storedUser = new StoredUserDao()。loadStoredUser(< KEY>);
log.info(found user:+ storedUser.getEmail());

// !!!错误!!!
new SomeOtherDao()。doSomeDataManipulationInTransaction();

} catch(Throwable e){
e.printStackTrace();
} finally {
ObjectifyFilter.complete();
installer.uninstall();




$ b当新的SomeOtherDao()。doSomeDataManipulationInTransaction()启动一个多个实体组上的事务我收到错误:



多个实体组中的事务只能在高级复制应用程序中使用



如何告诉远程api这是一个HRD环境? '未应用的作业百分比'设置为0,并且使用远程API的事务失败,就好像devserver正在使用主/从而不是HRD一样运行。将'未应用的工作比例'提高到零以上解决了问题。


I am using objectify 4 to write to the HRD datastore. Everything works fine in unit tests and running the application in devserver or production.

But when I try connect using the REMOTE API to the devserver datastore, an error is thrown when the code starts a XG transaction. While connecting with the Remote API, it seems to think that HRD is not enabled. This is how I connect ...

public static void main(String[] args) {
    RemoteApiOptions options = new RemoteApiOptions().server("localhost", 8888).credentials("foo", "bar");
    //options = options.
    RemoteApiInstaller installer = new RemoteApiInstaller();
    StoredUser storedUser = null;
    try {
        installer.install(options);
        ObjectifyInitializer.register();
        storedUser = new StoredUserDao().loadStoredUser(<KEY>);
        log.info("found user : " + storedUser.getEmail());

        // !!! ERROR !!!
        new SomeOtherDao().doSomeDataManipulationInTransaction();

    } catch (Throwable e) {
        e.printStackTrace();
    } finally {
        ObjectifyFilter.complete();
        installer.uninstall();
    }
}

When new SomeOtherDao().doSomeDataManipulationInTransaction() starts a transactions on multiple entity groups I get the error thrown :

transactions on multiple entity groups only allowed in High Replication applications

How can I tell the remote api that this is a HRD environment ?

解决方案

I had 'unapplied job percentage' set to 0 and transactions using the remote api failed as if the devserver was running with Master/Slave and not HRD. Raising the 'unapplied job percentage' above zero fixed the problem.

这篇关于远程API,Objectify和DevServer不喜欢交易?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆