2 Replies Latest reply on Dec 5, 2005 9:57 PM by Adrian Brock

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

    junk07 junk100 Newbie

      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 :
      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)

      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.

      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.


      JDK 1.5

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

          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:

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

          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.

          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.