首页 \ 问答 \ 如何加入一致性集群(How to join a coherence cluster)

如何加入一致性集群(How to join a coherence cluster)

我无法尝试访问/加入外部一致性群集。 在我当前的项目中,我有一个运行一致性集群的服务器(不是localhost),我需要加入该集群才能从该缓存中获取数据。

我正在尝试这个简单的代码,但它一直在我自己的机器上创建一致性(localhost)

public static void main(String[] args){

    XmlElement opConfig = XmlHelper.loadFileOrResource("C:\\Users\\916001\\Documents\\NetBeansProjects\\testAppProject\\src\\main\\resources\\tangosol-coherence-override.xml", "ACCESS_EXTERNAL_SERVER");
    NamedCache coherenceCache = CacheFactory.getCache("osbhmlmensage");
    System.out.println(CacheFactory.getCluster());
}

我期待的是加载“opConfig”,然后使用“CacheFactory.getCache”访问集群

在tangosol-coherence-override我把这个:

<unicast-listener>
  <socket-provider system-property="tangosol.coherence.socketprovider"/>
  <reliable-transport system-property="tangosol.coherence.transport.reliable"/>
  <well-known-addresses>
    <socket-address id="1">
      <address system-property="tangosol.coherence.wka">xxx.xxx.xxx.xxx</address>
      <port system-property="tangosol.coherence.wka.port">yyyy</port>
    </socket-address>
  </well-known-addresses>      
</unicast-listener>

在地址中我把服务器的IP和端口放在集群的端口上

我是oracle coherence缓存的新手,我目前正在使用Coherence 3.7。

谢谢!


I am having trouble trying to access/join an external coherence cluster. In my current project I have a server (not localhost) which is running a coherence cluster, and I need to join that cluster to get data from that cache.

I am trying this simple code, but it keeps creating a coherence in my own machine (localhost)

public static void main(String[] args){

    XmlElement opConfig = XmlHelper.loadFileOrResource("C:\\Users\\916001\\Documents\\NetBeansProjects\\testAppProject\\src\\main\\resources\\tangosol-coherence-override.xml", "ACCESS_EXTERNAL_SERVER");
    NamedCache coherenceCache = CacheFactory.getCache("osbhmlmensage");
    System.out.println(CacheFactory.getCluster());
}

What I am expecting from this is loading "opConfig" and then access the cluster by using the "CacheFactory.getCache"

In tangosol-coherence-override I put this:

<unicast-listener>
  <socket-provider system-property="tangosol.coherence.socketprovider"/>
  <reliable-transport system-property="tangosol.coherence.transport.reliable"/>
  <well-known-addresses>
    <socket-address id="1">
      <address system-property="tangosol.coherence.wka">xxx.xxx.xxx.xxx</address>
      <port system-property="tangosol.coherence.wka.port">yyyy</port>
    </socket-address>
  </well-known-addresses>      
</unicast-listener>

where in address I put the server's IP and the port I put the cluster's port

I am very new to oracle coherence cache and I am currently using Coherence 3.7.

Thank you!


原文:https://stackoverflow.com/questions/36358966
更新时间:2023-10-07 07:10

最满意答案

它们都是运行时检查。 但是有一些不同
JPA规范声明@Basic(optional = false)可以用作模式提示,即如果您通过JPA更新数据库模式(虽然通常不是一个好习惯),您可以使用它来指示此列值不能为null且必须有价值。

第9.1.18节JPA1规范的基本注释

第11.1.6节JPA2规范的基本注释

清楚地表明这一点。

除此之外,在将sql发送到数据库之前,两者都会进行运行时检查。
一般用于在将SQL发送到服务器之前进行验证,如果您使用的JSR 303包括许多其他检查,那么您将使用@NotNull但是您可能没有使用JSR 303,在这种情况下您可以使用@Basic(optional = false)甚至在JSR 303之前就已经出局了,但是不比JSR303更受欢迎。
您现在可能想知道@Column(nullable = false)纯粹用于数据库端。
您是否应该同时使用两者 - 只有在允许JPA更新架构时才会使用,否则JSR-303优先于另一个。


After reading both specifications almost entirely, this is what I found.

I'll thusly answer my question myself;
As of now;

  • JPA and BV annotations do often share the same meaning. The usage of BV constraints however does not influence the created DDL schema constraints of the JPA implementation.

  • The JPA implementation will, if configured so, check BV constraints at pre-persist, pre-update, and pre-remove. This is done by delegating the work to the BV implementation. The BV implementation on the other hand will not use JPA constraints.

  • Using BV constrains such as @NotNull to automatically cause JPA constraints such as @Column(nullable=false) is recommended to the JPA implementation in the BV specification, but not part of the official specification and thus not reliable behaviour.

As a result I will have to use both BV and JPA annotations, even though they may have the same meaning.

References

P.S.: I will wait whether someone has any corrections or additions to this, then set is as the preferred answer.

相关问答

更多

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。