proxy connection disconnects override configuration spaces [closed]

GigaSpaces group,

I have two question around client behavior when it cannot find the space cluster (system upgrade, network failure, ...). I am using GigaSpaces 7.1 version.

h2. Question#1 Client Proxy settings

The document listed in [proxy connectivity|http://www.gigaspaces.com/wiki/display/XAP71/Proxy+Connectivity] mentions that proxy-settings +should be specified as part of the space configuration (server side)+ I changed the pu.xml deployed in my local server and that worked beautifully and changed the retry count from 10 to 5. However the document also refers to [ http://www.gigaspaces.com/wiki/displa... ] which lists an example to override default configuration using the URLSpaceConfigurer

h4.The example

+UrlSpaceConfigurer spaceConfigurer = new UrlSpaceConfigurer("/./space").addProperty("space-config.serialization-type", "1");+

So I went ahead and kept the retries at the server to 5 and changed the code (the client) that connection to use 3. SpaceProperties is my object the comes from reading my own config, but as you see I am doing

configurer.addProperty("space-config.proxy-settings.connection-retries", "3");

h4. Code Example

public GigaSpace buildSpace(SpaceProperties spaceProperties) {

    assert spaceProperties != null;

    try {
        UrlSpaceConfigurer urlSpaceConfigurer = getUrlSpaceConfigurer(spaceProperties);
        GigaSpaceConfigurer gsConfigurer = new GigaSpaceConfigurer(urlSpaceConfigurer);
        return gsConfigurer.gigaSpace();

    }
    catch (CannotFindSpaceException e) {
        throw new GigaSpaceProviderException(StringUtils.append("SpaceFailure url=", spaceProperties), e);
    }

}

private UrlSpaceConfigurer getUrlSpaceConfigurer(SpaceProperties spaceProperty) {

    StringBuilder url = new StringBuilder();
    url.append(spaceProperty.getProtocol()).//
            append("://").//
            append(spaceProperty.getHost());
    int port = spaceProperty.getPort();
    if (port > 0) {
        url.append(":").append(port);
    }

    url.append("/").//
            append(spaceProperty.getContainerName()).//
            append("/").//
            append(spaceProperty.getSpaceName());

    String spaceURL = url.toString();

    UrlSpaceConfigurer configurer = new UrlSpaceConfigurer(spaceURL);
    configurer.noWriteLease(spaceProperty.isNoWriteLease());
    configurer.addProperty("useLocalCache", spaceProperty.isUseLocalCache() ? "true" : "false");
    String groups = spaceProperty.getGroups();

    if (StringUtils.hasText(groups)) {
        configurer.lookupGroups(groups);

    }

    if (spaceProperty.isVersioned()) {

        configurer.addProperty("versioned", "true");

    }

    *configurer.addProperty("space-config.proxy-settings.connection-retries", "3");*
    return configurer;

}

h4. Result My code (I hope straightforward) is building a connection to GigaSpaces via the url configurer and GigaSpaceConfigurer, and I am trying to override space-config.proxy-settings.connection-retries using the addProperty, but with my unit test when I shutdown gigaspaces (the server) I still get


22:15:23 I am thread: Thread-57 could not write to space, exception: org.openspaces.core.RemoteDataAccessException ; at org.openspaces.core.exception.DefaultExceptionTranslator@internalTranslate(DefaultExceptionTranslator.java:108):: at org.openspaces.core.exception.DefaultExceptionTranslator@internalTranslate(DefaultExceptionTranslator.java:103):: at org.openspaces.core.exception.DefaultExceptionTranslator@translate(DefaultExceptionTranslator.java:50):: at org.openspaces.core.DefaultGigaSpace@write(DefaultGigaSpace.java:629):: at org.openspaces.core.DefaultGigaSpace@write(DefaultGigaSpace.java:621):: at gallup.space.SpaceDisconnectionTest$2@run(SpaceDisconnectionTest.java:55):: at java.lang.Thread@run(Thread.java:662)::


2011-11-12 22:15:34,105 WARNING [net.jini.discovery.LookupLocatorDiscovery] - Exception occurred during unicast discovery to localhost:4164, retry in 240003ms. Please verify the unicast locators hostname and port are set properly.; Caused by: java.net.ConnectException: Connection refused 2011-11-12 22:15:38,828 INFO [com.gigaspaces.client] - Thread[Thread-58,5,main] No available members found - retrying [1/5] 2011-11-12 22:15:39,833 INFO [com.gigaspaces.client] - Thread[Thread-58,5,main] failed on no available member: localSpace_container1:localSpace - retrying [2/5] 2011-11-12 22:15:40,838 INFO [com.gigaspaces.client] - Thread[Thread-58,5,main] failed on no available member: localSpace_container1_1:localSpace - retrying [3/5] 2011-11-12 22:15:40,838 INFO [com.gigaspaces.client] - Thread[Thread-58,5,main] No available members found - retrying [4/5] 2011-11-12 22:15:41,843 INFO [com.gigaspaces.client] - Thread[Thread-58,5,main] failed on no available member: localSpace_container1:localSpace - retrying [5/5] 2011-11-12 22:15:42,848 INFO [com.gigaspaces.client] - Thread[Thread-58,5,main] failed on no available member: localSpace_container1_1:localSpace - stop retrying [5/5]

I can attach my unit test code but it really is creating multiple threads and they are all trying to connect to the space.

The question here Did I assume wrong is this property 100% need to be setup at the server only, no way a client can override?

h2. Question#2

Two important configurations that deals with gigaspace disconnects are

+cluster-config.groups.group.fail-over-policy.fail-over-find-timeout+ and +space-config.proxy-settings.connection-retries+

And it is working as it designed so when I ask for an operation (write, read,...) I fail only after I exhausted all retries, so Total Time is around #retries X timeout. However The actual singleton GigaSpace instance I use in my application never gets in an invalid state. Meaning I let my junit run for hours (same JVM) and I came back turn the local cluster back on and everything worked (read, writes, ....) Is that normal behavior

Thank you for your time and patience, +Ramzi+

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=3783]{quote}

asked 2011-11-13 12:39:58 -0600

ramzi gravatar image

updated 2013-08-08 09:52:00 -0600

jaissefsfex gravatar image
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Meron
close date 2017-07-27 08:44:37.491573