0 Replies Latest reply on Aug 9, 2005 5:03 PM by joseph.chen

    Converting from C++ Socket server program to EJB3 Clustered

    joseph.chen

      I am trying to convert a server that uses TCP sockets to connect with a bunch of VB clients, to JBOSS EJB3 Clustered architecture. I have wrote an example clustered EJB stateful bean with ServerSocket. My goal is to instantiate the bean in such a way that all nodes in the cluster will have it's ServerSocket listening on a port, say 9000, and with the bean's state variables shared among the corresponding instances on each node.

      However when the bean is deployed, only 1 instance of the bean is instantiated in one of the node (hence, this particular node is listening to port 9000) while the other nodes' corresponding bean instance remains "inactive" (however, I can clearly see the instance from the JMX console's stateful bean cache). So my questions are:

      [1] How can I "activate" the corresponding bean in other nodes so that they will also start listening to port 9000?
      [2] Is there anyway to implement a "main" function in an EJB bean or they have to be explicitly instantiated manually (say by a client EJB)
      [3] In another sense, I would like to make the EJB bean singleton throughout the whole cluster. Any pointers other than HASingleton service since HASingleton takes care of failover of 1 node over to another (but I would like to increase scalability by having more than one machine servicing the clients).

      Sorry for the rather redundant explanation of the issue I faced, I hope you get the idea what I am trying to do. Would greatly appreciate any suggestion on the architecture that would solve this.

      Cheers
      Joseph C