Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,170,647 members, 7,878,893 topics. Date: Wednesday, 03 July 2024 at 08:55 AM

JCA 1.0 Connector & Threads - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / JCA 1.0 Connector & Threads (3222 Views)

Why Do Threads From Programming Section Hardly Or Never Make FP? / Nairaland Programming Index(Topic Ordered Listing of Programming Board Threads). / I Need A Connector To Connect To Outlook (2) (3) (4)

(1) (Reply) (Go Down)

JCA 1.0 Connector & Threads by Fdeveloper(m): 12:32pm On Nov 22, 2006
I'm developing a JCA 1.0 connector which will be deployed in an instance of JBoss 3.2.x.  The connections to the EIS are via multi thread sockets and I've used a static initialisation block in my Connection Factory implementation class to connect the sockets to the EIS so it's automatically instantiated when JBoss is started. 

My question is I'm a little unsure as to how the socket threads will be handled when a connection is closed by a JCA connector client. More specifically, can I be sure that all the threads applicable to the connection being closed will be destroyed or is there a risk that the number of threads will just keep increasing until there are no more resources available? Does anyone have any experience of this and if so what were your findings?
Re: JCA 1.0 Connector & Threads by sbucareer(f): 3:52pm On Nov 22, 2006

First, I will say to upload the UML architecture or cross section of your UML architecture so we can build a picture of what you are trying to do.

I would suggest without fully understaning your project to make the connection a singleton class. Using static do not always work in a multi threaded environment as the only single entity after the death of the parent class could still have a reference to the live static object.

Example of a singleton class

public class Singleton {
   private static Singleton instance = null;
   protected Singleton() {
      // Exists only to defeat instantiation.
   }
   public static Singleton getInstance() {
      if(instance == null) {
         instance = new Singleton();
      }
      return instance;
   }
}

This way you will always be sure that every thread instance of your connector is destroyed.  You can force destroy implementation in your Singleton class by using the finally keyword in Java.

If I do not answer your question provide more scope to your project i.e. UML diagram or a RTP (Rich Text Picture) to fully understand your question.
Re: JCA 1.0 Connector & Threads by Fdeveloper(m): 2:59pm On Nov 24, 2006
Thanks for the feedback and I think using a Singleton class as you suggest might just do the trick. I'll try it and let you know.

I don't have a full UML architecture diagram yet but the following gives an overview of the solution in question. Where I will use multi-thread sockets is in the interface to the USSD Gateway.

Re: JCA 1.0 Connector & Threads by sbucareer(f): 6:40pm On Nov 24, 2006

Is like I know what you are trying to develop. It is complex. Do you work for a vendor that develop J2EE or application server? Writing Connector is a complex undertaking.

First you have to scope down your requirements. Are you connecting to an EIS or Web Server or application server. From your architecture I can see you are interest in connecting to USSD (Unstructured Supplementary Services Data), particularly for a GSM network.

I would assume your connector is a bi-directional service. Also are you anticipating any TS (Transaction Service)? Here is an overview of a typical Connector to a EIS using Adapter.

I need to understand your GSM network interface? What sort of EIS is your GSM gateway? Do you want a bi-directional service? Would your network handle a TS?

You would probably need like four API's:

1. Client Interface
2. Adapter
3. USSD Interface
4 Connector(s)

You could help a little bit if you could give me an overview, I may be able to help you more than you think

Re: JCA 1.0 Connector & Threads by Fdeveloper(m): 11:13am On Nov 28, 2006
Hi, sorry for the delay in replying but I was having problems getting internet access.

I'm working for a company that provides software solutions to GSM service providers here in Nigeria and the reason for going J2EE in this instance is the provider in question already has a JBoss cluster deployed on several Sun boxes running a number of their VAS services.

The USSD equipment manufacturer refused to give me direct access to the USSD gateway I guess to protect their intellectual property so what we have agreed is we would exchange XML-RPC messages via sockets. So in essence, my process will be a socket server listening for incoming requests from the USSD Gateway and spawning threads to handle them.

The connection is bi-directional but only in the sense that my connector has to synchronously acknowledge receipt of the message from the USSD Gateway or send an error message where applicable and then insert the message in a JMS queue. The client application will then consume the message from the JMS queue via a simple API I will provide or the client application may choose to consume the messages directly from the queue.

(1) (Reply)

How To Program A PHP SMS Gateway / Programming Logic Challenge / Checkout This New Forum I Made From Scratch

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 18
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.