[jgroups-users] problem with custom address

Questions/problems related to using JGroups <[email protected]> Thu, 31 May 2018 12:23:58 -0400
Newsgroups gmane.comp.java.javagroups.general
Message-ID <mailman.23056.1527785711.988.javagroups-users@lists.sourceforge.net>
Hi all,

JGroups 4.0.8.Final (maven): am trying a custom address so that we can
output the binding ip address or hostname of an Address whenever it's
logged. Really, just want to override toString with some more information.

Adding with this after creating the JChannel and before connecting:

        jChannel = <helper method>
        jChannel.addAddressGenerator(new AddressGenerator() {
            @Override
            public Address generateAddress() {
                return new TestAddress();
            }
        });

My whole TestAddress, sans extra whitespace, is below. When I use this,
every node starts ok, but none of them connect to anyone else, so each node
is its own cluster. On the 2nd node started, for instance, there are no
errors in the logs coming from jgroups -- just nothing happens after
discovery request is sent to the coordinator's address. I don't know if it
matters, but am using a TCP-based stack that I can send out.

Address class:

public class TestAddress extends UUID {
    static {
        ClassConfigurator.add((short) 5309, TestAddress.class);
    }
    final String extraInfo = "test"; // would be bind address or host name
in real case
    @Override
    public String toString() {
        return super.toString() + extraInfo;
    }
    // to make findbugs happy. not changing per
http://www.jgroups.org/manual4/index.html#CustomAddresses
    @Override
    public boolean equals(Object o) {
        return super.equals(o);
    }
    // because otherwise: java.lang.IllegalStateException:
TestAddress.create() returned the wrong class: UUID
    @Override
    public Supplier<? extends TestAddress> create() {
        return TestAddress::new;
    }
}

Any ideas on what I'm missing here that should be added/fixed?

Thanks,
Bobby

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
javagroups-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/javagroups-users