奇怪的是我没有通过谷歌搜索找到这个信息.使用Unix Domain套接字与TCP套接字建立连接的成本是多少?
现在我必须使用TCP套接字进行连接池,因为重新连接非常昂贵.我想知道我是否可以通过简单地切换到Unix域套接字并摆脱连接池来简化我的客户端.
我有以下实体(不相关的字段/方法被删除).
public class HitsStatsTotalDO
{
@Id
transient private Long targetId;
public Key<HitsStatsTotalDO> createKey()
{
return new Key<HitsStatsTotalDO>(HitsStatsTotalDO.class, targetId);
}
}
Run Code Online (Sandbox Code Playgroud)
所以...我正在尝试批量获取10个对象,我使用它来构造键HitsStatsTotalDO.createKey()
.我试图在事务中获取它们,如下所示:
final List<Key<HitsStatsTotalDO>> keys = ....
// This is being called in transaction..
Map<Key<HitsStatsTotalDO>, HitsStatsTotalDO> result = DAOBase.ofy().get(keys);
Run Code Online (Sandbox Code Playgroud)
抛出以下异常:
java.lang.IllegalArgumentException: operating on too many entity groups in a single transaction.
你能详细说明有多少太多以及如何解决它?我在文档中找不到确切的数字.
谢谢!
google-app-engine transactions objectify google-cloud-datastore
我是RequestFactory的新手,但在Thomas Broyer的慷慨帮助下,在审阅了下面的文档后,它变得更好:)
但是,请你解释为什么Locator<>.find()
经常被不必要地(在我看来)被召唤?
在我的示例项目中,我有两个维护父子关系的实体Organization和Person.当我获取组织Objectify时自动获取子Person.我还在服务层中创建了两个方法findOrganizationById
,saveOrganization
即加载和持久化对象.
现在考虑两种情况:
当我findOrganizationById
在客户端呼叫后,在服务器端发生呼叫:
OrderDao.findOrganizationById(1)
PojoLocator.getId(Key<?>(Organization(1)))
PojoLocator.getId(Key<?>(Organization(1)/Person(2)))
PojoLocator.getId(Key<?>(Organization(1)))
PojoLocator.find(Key<?>(Organization(1)))
PojoLocator.getId(Key<?>(Organization(1)/Person(2)))
PojoLocator.find(Key<?>(Organization(1)/Person(2)))
Run Code Online (Sandbox Code Playgroud)
通过调用OrderDao.findOrganizationById
我已经收到完整的对象图.为什么.find
除此之外还要打两次电话?数据存储的额外负载花了我钱.当然我会缓存它,但修复它会很好.如何避免这些额外的通话?
当我通过saveOrganization
在客户端中调用来保存对象时,会发生类似的事情.以下调用发生在服务器端:
PojoLocator.find(Key<?>(Organization(1)))
PojoLocator.find(Key<?>(Organization(1)/Person(2)))
OrderDao.saveOrganization(1)
PojoLocator.getId(Key<?>(Organization(1)))
PojoLocator.find(Key<?>(Organization(1)))
PojoLocator.getId(Key<?>(Organization(1)/Person(2)))
PojoLocator.find(Key<?>(Organization(1)/Person(2)))
Run Code Online (Sandbox Code Playgroud)
我可以理解在更新之前需要从DataStore中获取两个对象.RequestFactory将增量发送到服务器,因此在持久化之前需要拥有整个对象.自从我一次加载完整的图表后,不再进行第二次调用会很好PojoLocator.find(Key<?>(Organization(1)/Person(2)))
.在坚持不懈之后,我真的无法理解.find()
呼叫的需要.
想法?
我的代理人
@ProxyFor(value = Organization.class, locator = PojoLocator.class)
public interface OrganizationProxy extends EntityProxy
{
public String getName();
public void setName(String name);
public String …
Run Code Online (Sandbox Code Playgroud) 我可以使用什么工具.Net/C#项目来捕获类之间的运行时依赖关系?我发现这个问题非常有用,但建议的工具捕获静态依赖图.我只是想看看类的实例化图.
我正在使用VS 2008(但如果需要可以安装其他版本).
UPD:我的目标是这样的.我有很大的旧代码库.它有(例如)500个类但由于DB驱动的工作流程多年来发生了变化(例如)现在使用了100个类.这就是静态依赖性分析太难以消化的原因.
如何使用Kryo反序列化不可变集合?除了我做的事情之外,我还需要注册一些东西吗?
这是我的示例代码
import com.esotericsoftware.kryo.Kryo
import com.esotericsoftware.kryo.io.Input
import com.esotericsoftware.kryo.io.Output
import com.romix.scala.serialization.kryo._
val kryo = new Kryo
// Serialization of Scala maps like Trees, etc
kryo.addDefaultSerializer(classOf[scala.collection.Map[_,_]], classOf[ScalaMapSerializer])
kryo.addDefaultSerializer(classOf[scala.collection.generic.MapFactory[scala.collection.Map]], classOf[ScalaMapSerializer])
// Serialization of Scala sets
kryo.addDefaultSerializer(classOf[scala.collection.Set[_]], classOf[ScalaSetSerializer])
kryo.addDefaultSerializer(classOf[scala.collection.generic.SetFactory[scala.collection.Set]], classOf[ScalaSetSerializer])
// Serialization of all Traversable Scala collections like Lists, Vectors, etc
kryo.addDefaultSerializer(classOf[scala.collection.Traversable[_]], classOf[ScalaCollectionSerializer])
val filename = "c:\\aaa.bin"
val ofile = new FileOutputStream(filename)
val output2 = new BufferedOutputStream(ofile)
val output = new Output(output2)
kryo.writeClassAndObject(output, List("Test1", "Test2"))
output.close()
val ifile = new FileInputStream(filename)
val …
Run Code Online (Sandbox Code Playgroud) 如何让 sbt 将非 Java 源包含到已发布的工件中?
我正在使用 Kotlin 插件,但不知道如何强制 sbt 将 .kt 文件包含到已发布的源 jar 中。它只包含 .java 文件。
网上很多人建议将以下代码添加到 sbt 脚本中,但没有帮助
mappings in (Compile, packageSrc) ++= {
val base = (sourceManaged in Compile).value
val files = (managedSources in Compile).value
files.map { f => (f, f.relativeTo(base).get.getPath) }
},
Run Code Online (Sandbox Code Playgroud)
我也试过
includeFilter in (Compile, packageSrc) := "*.scala" || "*.java" || "*.kt",
Run Code Online (Sandbox Code Playgroud)
这是 sbt 控制台中一些变量的输出
sbt:collections> show unmanagedSourceDirectories
[info] * /home/expert/work/sideprojects/unoexperto/extensions-collections/src/main/scala
[info] * /home/expert/work/sideprojects/unoexperto/extensions-collections/src/main/java
[info] * /home/expert/work/sideprojects/unoexperto/extensions-collections/src/main/kotlin
sbt:collections> show unmanagedSources
[info] * /home/expert/work/sideprojects/unoexperto/extensions-collections/src/main/java/com/walkmind/extensions/collections/TestSomething.java
Run Code Online (Sandbox Code Playgroud) 什么Visual Studio插件打开.oradbproj文件?这是我的解决方案的一部分.
我有VS 2010并安装了Oracle 11g客户端x64,但它没有帮助.
如何在IDEA中使用外部Scala编译器?我似乎随机出现错误说"scala:无法连接到localhost/127.0.0.1:3200的编译服务器"
有时它有效.有时却没有.我找不到模式.
这是我在日志中的内容
9:20:58 PM Auto make completed with errors
9:21:09 PM Using a new (SBT-based) Scala compiler.
In case of any compilation problems you may enable the previous (internal) compiler by clearing:
Project Settings / Compiler / Use external build
9:21:10 PM Scala compile server
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
9:21:12 PM Compilation completed with 1 error and 0 warnings in 3 sec
Run Code Online (Sandbox Code Playgroud)
我正在使用
如何混合有型和无类型的演员?我了解我的,当我创建实例指定主要演员ActorSystem
像这样
val system: akka.typed.ActorSystem[Start] = akka.typed.ActorSystem("main", Props(mainBehaviour))
Run Code Online (Sandbox Code Playgroud)
另一方面,我使用像这样初始化的akka-http
implicit val system = ActorSystem()
implicit val executor = system.dispatcher
implicit val materializer = ActorMaterializer()
// etc...
Run Code Online (Sandbox Code Playgroud)
我看到我可以通过调用从无类型系统创建类型化系统
object ActorSystem {
def apply(untyped: akka.actor.ActorSystem): ActorSystem[Nothing] = new Wrapper(untyped.asInstanceOf[ExtendedActorSystem])
}
Run Code Online (Sandbox Code Playgroud)
所以假设我做到了
val typeSystem = akka.typed.ActorSystem(untypedSystem)
Run Code Online (Sandbox Code Playgroud)
如何创建我的第一个键入的演员typeSystem
?有没有类型化的ActorContext
,其actorOf
我可以打电话.
我读过的关于这个主题的其他材料是
我google了很多,但..
如何在psql的命令行查询中转义单引号?
psql -t -A -F $'\t' postgresql://zzzz:5432/casedb -U qqqq -c 'select id,ext_ids ->> 'qwe' as qwe from data ORDER BY qwe' > /jdata/qwe.tab
Run Code Online (Sandbox Code Playgroud)
导致错误
ERROR: column "qwe" does not exist
LINE 1: select id,ext_ids ->> qwe as qwe from data...
Run Code Online (Sandbox Code Playgroud) scala ×4
actor ×1
akka ×1
akka-http ×1
akka-typed ×1
c# ×1
gwt ×1
gwt2 ×1
java ×1
kryo ×1
objectify ×1
oracle11g ×1
postgresql ×1
psql ×1
quoting ×1
sbt ×1
scala-2.10 ×1
tcp ×1
transactions ×1
unix-socket ×1