2 Replies Latest reply on Dec 5, 2005 9:57 PM by adrian.brock

    JCA - best approach to implement keep-alive on socket connec

    junk07100

      I've implemented a non-transacted JCA Connector based on the example given in the JBoss manual. It manages a pool of tcp/ip socket connections to a legacy mainframe application.

      The pool needs to keep a certain number of connections active when they are not being used by sending a special keep-alive request to the mainframe. I've looked at the JCA spec and the searched the forums but I haven't come across any simple way to this.

      Options :
      #1
      Ideally I'd like the app-server to periodically invoke a method on each connection object in the free pool requesting it to send its keep-alive packet. (apologies if I've missed some really obvious way of doing this)

      #2
      Using the WorkManager I could perhaps have a seperate task for each connection that periodicly called a method on it, if it was not in use.

      #3
      The JCA 1.5 spec refers to an optional interface the ManagedConnectionFactory instance can implement , ValidatingManagedConnectionFactory, but I didn't find any references to it in the JBoss manual. Does JBoss use this optional interface and if so how often does it invoke it?

      Hopefully I've missed a simple solution to this, if not perhaps you could suggest the best approach.

      Shane

      JBoss-4.0.3SP1
      JDK 1.5

        • 1. Re: JCA - best approach to implement keep-alive on socket co
          starksm64

          We don't have any use of the ValidatingManagedConnectionFactory currently. I would imagine its due to the underwhelming description from the jca spec:

          "j2ee_connector-1_5-fr-spec" wrote:

          6.5.3.4 Detecting Invalid Connections
          import java.util.Set;
          interface ValidatingManagedConnectionFactory {
           Set getInvalidConnections(Set connectionSet) throws
           ResourceException;
          }
          


          This interface may be implemented by a ManagedConnectionFactory instance that supports the ability to validate ManagedConnection objects. The getInvalidConnections method returns a set of invalid ManagedConnection objects chosen from a specified set of ManagedConnection objects. This optional functionality may be used by the application server to prune invalid ManagedConnection objects from its connection pool periodically.


          If you want to work towards an implementation of this that we would integrate into jboss and support going forward that would be good. Go to the JCA design forum if your interested in pursuing that path.
          http://www.jboss.com/index.html?module=bb&op=viewforum&f=165

          We have jdbc sepcific notions for connections, but they are not time based polling checks. They are checks invoked when the connections are taken from the pool or used.

          #2 is what I would pursue otherwise.


          • 2. Re: JCA - best approach to implement keep-alive on socket co

            BootstrapContext.createTimer();