openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Woods <dwo...@apache.org>
Subject Re: How to set openjpa.RemoteCommitProvider to tcp for cluster of servers running same app on same machine.
Date Fri, 12 Feb 2010 13:42:45 GMT
Take a look at the following junit or others in that directory -
openpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/event/TestTCPRemoteClassChanges.java

. . .
        OpenJPAEntityManagerFactory pmfSender = createDistinctFactory(
            TCPRemoteCommitProvider.class,
            "Port=5636, Addresses=127.0.0.1:5636;127.0.0.1:6636");
        OpenJPAEntityManagerFactory pmfReceiver = createDistinctFactory(
            TCPRemoteCommitProvider.class,
            "Port=6636, Addresses=127.0.0.1:6636;127.0.0.1:5636");
. . .
    protected OpenJPAEntityManagerFactory createDistinctFactory(
        Class providerClass, String classProps1) {
        Map propsMap;

        if (providerClass != null) {

            propsMap = new HashMap();
            propsMap.put("openjpa.RemoteCommitProvider", Configurations.
                getPlugin(providerClass.getName(), classProps1));
            propsMap.put("openjpa.FetchGroups",
"differentiatingFetchGroup" +
                _fetchGroupSerial);
        } else {
            // No RCP
            propsMap = new HashMap();
            propsMap.put("openjpa.RemoteCommitProvider", "sjvm");
            propsMap.put("openjpa.FetchGroups",
"differentiatingFetchGroup" +
                _fetchGroupSerial);
        }
        _fetchGroupSerial += 1;

        return getEmf(propsMap);
    }


-Donald


On 2/10/10 8:01 PM, Ravi P Palacherla wrote:
> 
> Hi All,
> 
> How to set openjpa.RemoteCommitProvider to tcp if I have cluster of two
> servers, running on same machine,  using same openjpa application ?
> 
> If serverA uses port 7001 to listen for cache change notifications then
> serverB cannot listen to the same port. It complains saying "Address already
> in use: JVM_Bind"
> 
> Hence is it even possible (and) if possible can some one please give me a
> sample configuration for openjpa.RemoteCommitProvider.
> 
> Regards,
> Ravi.
> 

Mime
View raw message