3 Replies Latest reply: Dec 18, 2013 6:29 AM by user123799 RSS

    Proxy Failure Detection using Member Listener

    1028528

      Hi Guys,

       

      I have registered a MemberListener on my Java *Extend client to detect a Proxy Failures and re-connect immediately, which is working fine. However, when *Extend client attempts to re-connect it tires to connect to the Proxy which just died, then it realizes it cannot make an connection and then tries to connect to another proxy in the list. I would like to optimize this buy removing the proxy which just died from the list of available proxies, but the thing is in the 'memberLeft' event, I don't get the details of the proxy which just died. Am i missing something here?

       

      Here is code snippet

      {code}

       

      SafeCacheService cacheService = (SafeCacheService)CacheFactory.getService("ExtendTcpProxyService");

        cacheService.addMemberListener(new MemberListener() {

         @Override
         public void memberLeft(MemberEvent arg0) {
          System.out.println("memeber left. MachineName = " + arg0.getMember().getMachineName() + ",  memberName=" + arg0.getMember().getMemberName() + ", memberId= " + arg0.getMember().getId() + ", Port= " + arg0.getMember().getPort() );
         }

         @Override
         public void memberLeaving(MemberEvent arg0) {
          System.out.println("memebr leaving ");    
         }

         @Override
         public void memberJoined(MemberEvent arg0) {
          System.out.println("memebr Joined ");

         }
        });

      {code}

       

      Output:

       

      2013-11-04 21:39:38.089/29.472 Oracle Coherence GE 3.7.1.6 <D6> (thread=ExtendTcpProxyService:TcpInitiator, member=n/a): Closed: Channel(Id=178849014, Open=false)memebr leaving
      2013-11-04 21:39:38.089/29.472 Oracle Coherence GE 3.7.1.6 <D6> (thread=ExtendTcpProxyService:TcpInitiator, member=n/a): Closed: Channel(Id=1758436466, Open=false)
      2013-11-04 21:39:38.089/29.472 Oracle Coherence GE 3.7.1.6 <D6> (thread=ExtendTcpProxyService:TcpInitiator, member=n/a): Closed: TcpConnection(Id=0x00000142250CBE14233B2E263B31CBF09BCAFC19E87958B1C7A86F7E7A6F59AD, Open=false, Member(Id=0, Timestamp=2013-11-04 21:39:10.554, Address=35.134.120.1:0, MachineId=0, Location=site:,machine:buxtonldnrs1,process:5772, Role=BarclaysTestExtendClient), LocalAddress=0.0.0.0:3734, RemoteAddress=35.59.46.38:9098) due to:
      com.tangosol.net.messaging.ConnectionException: TcpConnection(Id=0x00000142250CBE14233B2E263B31CBF09BCAFC19E87958B1C7A86F7E7A6F59AD, Open=true, Member(Id=0, Timestamp=2013-11-04 21:39:10.554, Address=35.134.120.1:0, MachineId=0, Location=site:,machine:buxtonldnrs1,process:5772, Role=BarclaysTestExtendClient), LocalAddress=0.0.0.0:3734, RemoteAddress=35.59.46.38:9098)
      at com.tangosol.coherence.component.util.daemon.queueProcessor.service.peer.initiator.TcpInitiator$TcpConnection$TcpReader.onNotify(TcpInitiator.CDB:49)
      at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
      at java.lang.Thread.run(Thread.java:662)
      Caused by: java.net.SocketException: Connection reset
      at java.net.SocketInputStream.read(SocketInputStream.java:168)
      at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
      at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
      at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:271)
      at com.tangosol.util.ExternalizableHelper.readInt(ExternalizableHelper.java:539)
      at com.tangosol.coherence.component.util.daemon.queueProcessor.service.peer.initiator.TcpInitiator$TcpConnection$TcpReader.onNotify(TcpInitiator.CDB:20)
      at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
      at java.lang.Thread.run(Thread.java:662)


      memeber left.. MachineName = buxtonldnrs1,  memberName=null,  memberId=0, Port=0

       

      Basically, I want to get the details of the proxy which just died, any ideas of how to get these details will be much appreciated.

       

       

      Thanks

      D


        • 1. Re: Proxy Failure Detection using Member Listener
          1028528

          Guys,

           

          Any ideas? Would really appreciate your help.

           

          Thanks

          D

          • 2. Re: Proxy Failure Detection using Member Listener
            DJW

            You might try implementing com.tangosol.net.AddressProvider to record the last address returned, and to not use the same one next time?

            • 3. Re: Proxy Failure Detection using Member Listener
              user123799

              It's been a while since I've been in this area, but I think the issue is that as an extend client some of the data doesn't make sense i.e getPort() returns the datagram port of the node not, as you were probably expecting, the extend port your client connected to.  So I think you might be limited in what you can obtain.  The getUid() call should work and should allow you to identify and remove the proxy from those available, (using a custom AddressProvider as DJW suggests).

               

              Be careful that you're not interfering if the local service is restarting for some reason. Always check the isLocal() to filter out local issues, i.e. your node deciding to disconnect from the proxy, rather than the other way around. The calls you can make for local events are restricted - see docs.