geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marshall Crocker" <croc...@cavs.msstate.edu>
Subject Re: Running a non web java application
Date Thu, 13 May 2010 16:37:57 GMT
Hi David,

Thanks for the suggestions!  I think the gbean approach is my best choice of the solutions
you've given.  But I think the easiest and fastest solution for me is to implement a simple
server that is started in its own thread when the web app starts.  This server would simply
accept connections on a given socket and handle each transaction in a separate thread.

What drawbacks are there to doing it this way?  I would have to be very careful to limit the
server threads to prevent any kind of denial of service attack but other than that what problems
may I encounter?

The benefits to this method besides being the easiest and fastest for me to implement is that
the server would have direct access to all of my web app classes and resources. So it would
be able to process the data from the client, create the appropriate objects and save them
to the database.  Basically it would act the same as the servlets that now accept this data
and process it but without all the overhead and limitations of http.

Thanks!
Marshall

>>> David Jencks <david_jencks@yahoo.com> 5/6/2010 11:17 AM >>>
Hi Marshall,

There are several things you can do here.  What's best may depend on quite a few factors including
how heavily loaded this service is going to be and how you want to configure it.

The most javaee way to approach this is to write an inbound j2ca resource adapter that listens
on the socket, retrieves messages, and feeds them to an MDB (possibly with a custom message
listener interface).  Then your mdb will receive the message in an object and can get access
to jpa, jta, jdbc connection pools, etc etc in the standard javaee fashion.  The ee container
will supply the thread pooling etc for your service.

If you are happy handling thread pooling for requests yourself, you can just write a gbean
service and configure it in your geronimo web app plan.  In this case if you want to use connection
pools you will have to look them up in global jndi, there is no java:comp context for gbeans.
 The global jndi names for connection pools are printed in the geronimo log as they are set
up.

If you are being extremely adventurous and working with geronimo 3 you could alternatively
set up your service under osgi perhaps using blueprint and find the datasource in the osgi
services registry.

thanks
david jencks

On May 6, 2010, at 7:12 AM, Marshall Crocker wrote:

> Not to hijack this thread but I was wondering the same thing.
> 
> In my web app, I want to be able to receive TCP data on a socket. That data will then
be parsed and saved to a DB.  Clients would connect directly to the TCP socket and transfer
the raw data.
> 
> Currently the way clients pass data is through the URL such as http://website.com/Servlet?var1=0&var2=1...
  Since these are mobile devices transmitting using GPRS, I want to eliminate all the http
overhead and move to a straight TCP connection.
> 
> Any thoughts?
> 
> Thanks,
> Marshall
> 
>>>> David Jencks <david_jencks@yahoo.com> 5/5/2010 12:45 PM >>>
> You can definitely run it in geronimo (he says with unwarranted overconfidence :-)
> 
> You probably want to start it differently than you do as a standalone server.  To give
advice I'd need to know more about your server including...
> 
> -- how do it's clients connect to it
> -- what geronimo services you want it to use.
> -- what setup happens when you start it now
> 
> For future-proofing this at the risk of having more uncertainty now you might want to
consider packaging your server as an osgi bundle and starting it with an activator (or assembling
it with osgi blueprint) and using geronimo 3 (still definitely under development) or if you
don't need significant geronimo services felix karaf.
> 
> thanks
> david jencks
> 
> On May 5, 2010, at 10:10 AM, Kevin Winterton wrote:
> 
>> Hi,
>> 
>> I have designed a Java application that runs like its own server and has php websites
communicating directly with it.  I was just wondering if there was any way I could use Geronimo
to run this application on Geronimo, and if so were I should put it.  It was designed in eclipse
just as a Java Project, and when exported is made into a JAR file.  Is it possible to use
Geronimo to host an application like this, or can it only be used for things like servlets,
JSP and EJBs.
>> 
>> Please let me know if you need more information, I've already tried loading the JAR
through the Console and it was placed in the App Clients section.
>> 
>> Thanks,
>> Kevin
>> 
> 
> 



Mime
View raw message