[jboss-user] [JBossWS] - Multithreading in Jboss 4.0.1

pranav.akiri do-not-reply at jboss.com
Mon Oct 15 16:39:50 EDT 2007


Hi,

We are trying to connect to a third party webservice to propagate the changes to the thirdparty system(in the suggeted JNDI look up pattern described in the jboss-webservice tutorial and it is working fine)

Since the number of propagation updates are large,now we wanted to have parallel updates to the third party system,which is like having a master thread creaing few child threads,each will take,say 1000 records and updates in the 3rd party system using the webservices in parallel.

Now,we are having an issue while using multiple threads.If I understand correctly,I guess the issue is because,we are sharing websevice client name registered in the JNDI,and it is giving exceptions.

Has anyone have any idea of how can invoke multi threading with webservices.In the other way,we are trying to have multiple threads connecting the same webservice concurrently in the same appserver.

we are using JBoss 4.0.1 and jdk 1.4

Any suggestions would be appreciated.Following is the code snippet for conencting to webservices:

==========================================
private boolean connect() throws Exception
    {
    	 if(!isConnected)
         {
             Properties env = new Properties();
             env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
             env.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client:org.jboss.naming");
             env.setProperty(Context.PROVIDER_URL, JNDI_URL);
             env.setProperty("j2ee.clientName", "nn-ws4ee-client");
             
             try
             {
                 InitialContext iniCtx = new InitialContext(env);
                 Service service = (Service)iniCtx.lookup(NN_CLIENT_JNDI_NAME);
                 nrdInterface = (NRD)service.getPort(NRD.class);
                 ((Stub)nrdInterface)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, url);
                 isConnected = true;
             }
             catch(Exception exc)
             {
                logger.fatal("NN Client Wrapper initialization exception.  " +
                             "The JNDI may not be correctly configured as follows: JNDI Location: " + JNDI_URL +
                             " NN Client JNDI Name: " + NN_CLIENT_JNDI_NAME);
                logger.fatal("NN Client Wrapper initialization exception:", exc);
                
                isConnected = false;
                throw exc;
             }
         }
    	 return isConnected;
    }
============================

Thanks

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095404#4095404

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095404



More information about the jboss-user mailing list