Design of a Java wiki plugin
Greetings to all,
I didn't know where I had to post that question exactly, so I've choosen to write that here. I hope I've not mistaken.
So, I'm developing a plugin for a wiki clone (media wiki) and I've thougth to implement it as a web service because it can be resident on another host than the wiki one.
At some events (ex. a page saving), the wiki invokes some plugin methods.
The problem is: that plugin allocates very much classes and data structure at each wiki invocation.
I think that it could be a better idea to develop the plugin as a ever-running server waiting for incoming requests, so I'll have all classes and data-structure ever allocated. I hope that it will increase the system responsiveness...
How should I proceed to implement that idea? I've still never used Web service technology so I don't know if a "web service" server can keep all the stuff allocated or the garbage collector eliminates all from an invocation to another. Should I implement the server as a ever-running application (with a infinite loop, for example) and wait for some messages from the web service server?
Thank you very much, and excuse me for my not great english ;)
> The problem is: that plugin allocates very much
> classes and data structure at each wiki invocation.
> I think that it could be a better idea to develop the
> plugin as a ever-running server waiting for incoming
> requests, so I'll have all classes and data-structure
> ever allocated. I hope that it will increase the
> system responsiveness...
In order to run a webservice you need something listening at all times fr requests. This is easy to implement in Java. Is that what you are asking?
> How should I proceed to implement that idea? I've
> still never used Web service technology so I don't
> know if a "web service" server can keep all the stuff
> allocated or the garbage collector eliminates all
> from an invocation to another. Should I implement the
> server as a ever-running application (with a infinite
> loop, for example) and wait for some messages from
> the web service server?
You should use a web container such as Tomcat or XFire to do this.
I'm a little unsure of why you need your plugin to run on a separate computer, though. Can you explain why you need that?
> In order to run a webservice you need something
> listening at all times fr requests. This is easy to
> implement in Java. Is that what you are asking?
>
Yes I need something like that, but I don't want an application that starts from scratch at every soap request, but an always active service, so that the allocated classes and resources could be rapidly available at each invocation instead of reinitializing everything all the time.
How can I implement it? It is possible with the actual java web service tools (that I just begun studiyng...) to set up an application like that?
At the end, it's similar to a sort of server listening to a socket all the time, i suppose that it is possible to create such an application with available web services tools..
I suppose that is an easy app to implement, my intent is to just verify that I'm moving to the right direction.
> You should use a web container such as Tomcat or
> XFire to do this.
>
> I'm a little unsure of why you need your plugin to
> run on a separate computer, though. Can you explain
> why you need that?
It's an idea proposed to me by my professor (I'm a student ;) ), I just have to try it. It's probably because he wants a general purpose plugin available to other apps too...
I'll prefer a Tomcat solution indeed.. I have some practice with that tool
Thank you very much for the interest ;)
> Yes I need something like that, but I don't want an
> application that starts from scratch at every soap
> request, but an always active service, so that the
> allocated classes and resources could be rapidly
> available at each invocation instead of
> reinitializing everything all the time.
You just need an app server like Tomcat.
> How can I implement it? It is possible with the
> actual java web service tools (that I just begun
> studiyng...) to set up an application like that?
> At the end, it's similar to a sort of server
> listening to a socket all the time, i suppose that it
> is possible to create such an application with
> available web services tools..
Apache Axis: http://ws.apache.org/axis/
> You just need an app server like Tomcat.
If I'm not wrong, Tomcat is a Servlet container. Servlets aren't deactivated when they don't receive any request for some time?
How can I deploy an application to Tomcat in order to keep it always active?
> Apache Axis: http://ws.apache.org/axis/
Yes I'm collecting some info about this... let's see it!
Finally, to be more clearer... I don't want to start a new application at each invocation (something like getting the request, instantiating the necessary classes and executing them) but to call an already running app at each invocation (so, getting request and invoking, in a manner that I don't know, the running application).
I can use Axis to get the request, but it also grants me that my app will always be active?
Maybe I'm asking something trivial, in case, please excuse me :D
> > You just need an app server like Tomcat.
>
> If I'm not wrong, Tomcat is a Servlet container.
> Servlets aren't deactivated when they don't receive
> any request for some time?
> How can I deploy an application to Tomcat in order to
> keep it always active?
I don't know what you mean. Tomcat is an application that is always running. In what way are the Servlets deactivated?
> > Apache Axis: http://ws.apache.org/axis/
>
> Yes I'm collecting some info about this... let's see
> it!
>
> Finally, to be more clearer... I don't want to start
> a new application at each invocation (something like
> getting the request, instantiating the necessary
> classes and executing them) but to call an already
> running app at each invocation (so, getting request
> and invoking, in a manner that I don't know, the
> running application).
The container manages this. If you have data that must remain loaded, you can associate it with the class (use a static modifier.) This will complicate threading, however.
> I can use Axis to get the request, but it also grants
> me that my app will always be active?
I think you are just using the wrong terminology here. What I think you are asking is whether the resources will be loded into memory at all times. If you want to ensure this behavior, you need to associate the data with a class. I'm not 100% positive, but I don't think Tomcat will unload classes in normal circumstances.
> I don't know what you mean. Tomcat is an application
> that is always running. In what way are the Servlets
> deactivated?
Sorry I've made confusion with Session Beans life cycle, excuse me.
> I think you are just using the wrong terminology
> here. What I think you are asking is whether the
> resources will be loded into memory at all times. If
> you want to ensure this behavior, you need to
> associate the data with a class. I'm not 100%
> positive, but I don't think Tomcat will unload
> classes in normal circumstances.
What do you exactly mean with "associate the data with a class"?
However, I know that a class is collected when there is no reference to it.
Axis, if I'm not wrong, is a framework that permits to set up some sort of "listener" of soap requests, right? I suppose that this listener is always active in the virtual machine (because it has to listen to potentially infinite new requests). If that listener has some reference to the core classes of my plugin, can I expect that those classes would not be ever collected?
However, It's all about getting more into Axis. I've asked you those info because I wanted to know if using Axis is the right way to proceed.. I suppose yes ;)
Thank you again. I'll let you know.
Message was edited by:
LiquidShadow
