Module initialization

Poster Content
nk4um Administrator
Posts: 607
July 15, 2008 21:47An example
I have attached a link to a an example module which specifically contains a postInstall entrypoint which installs an initHook.

http://www.1060.org/upload/InitHook.jar

Hope this elucidates,
Tony
Like · Post Reply
nk4um User
Posts: 79
July 15, 2008 19:25Module Initialization
Specifically, I am looking for an example of

using a postInstall entrypoint to install a hook


Both the entrypoint and script??
Like · Post Reply
nk4um User
Posts: 79
July 15, 2008 19:01Module Initialization - Practicalities
How does one updates the initHooks XML?

Do I have to create another module that SINKs the updated initHooks XML to the System Component Accessor? If that is the case how do I make sure that my new module is called upon start-up?

Or do I unpack ext-kernel-1.0.9.jar, modify initHooks and redeploy as an unpacked directory?

Or is there a better option (I really do not prefer either of the two options listed above)?

Please advise with an example.
Like · Post Reply
nk4um Administrator
Posts: 607
April 11, 2006 09:33Thoughts
After some wandering around I''ve got it to work, using a postInstall entrypoint to install a hook. Which then nicely runs after each restart.


That''s great. It is a bit of an esoteric feature. I was hoping that CRON would eventually replace it. Maybe it can''t. :-(

I''m still thinking a bit about warming the cache. Our data document is pretty large and takes too long to load, i.e. the connection will time out before the user sees anything. So I want it to stay in the memory. One way is to make sure it stays in the cache. Another approach I may follow is to add a static: URI scheme (e.g. static:active:tds.data), which will allow me to bypass the cache to keep some (in fact 2: the data and the meta data) documents always in memory.


I would hope that the cache would be smart enough to keep this high value item around. If it isn''t then you could consider raising it''s creation cost value. Another possibility is that you''re running in to tight a heap?

If the value truely wants to be kept and it''s lifecycle actively managed (We do this with the entrypoints table in the backend fulcrum) then you could store it in some static location. You have at least two choices:

1) like you say, create a new scheme and map a data storage service, either in memory or on the filesystem or db to it. (See the transient accessor in the ping pong demo for an example of this)

2) just use the ffcpl: scheme to store values on the filesystem in a module private way.

Hope this helps,
Tony
Like · Post Reply
nk4um User
Posts: 111
April 11, 2006 08:43Works (2)
[ Sorry, pressed the enter key a bit too early ... ]

Hi Tony,

After some wandering around I''ve got it to work, using a postInstall entrypoint to install a hook. Which then nicely runs after each restart.

I''m still thinking a bit about warming the cache. Our data document is pretty large and takes too long to load, i.e. the connection will time out before the user sees anything. So I want it to stay in the memory. One way is to make sure it stays in the cache. Another approach I may follow is to add a static: URI scheme (e.g. static:active:tds.data), which will allow me to bypass the cache to keep some (in fact 2: the data and the meta data) documents always in memory.

Thanks,

Menzo
Like · Post Reply
nk4um User
Posts: 111
April 11, 2006 08:32Works
Like · Post Reply
nk4um Administrator
Posts: 607
April 10, 2006 14:58Solutions
Hi Menzo,

Yes CRON is the most flexible solution but it does have the disadvantage that other external requests will be admitted in parallel at that time.

Generally I wouldn''t recommend that you do special pushing into the cache to "warm" the system before use. In our experience the additional complexity just isn''t worth it. However I do understand that sometimes you may want to run one of executions.

The solution is to use a custom init hook created by a post_install entrypoint

See:
http://docs.1060.org/docs/3.0.0/book/solutiondeveloperguide/doc_guide_ext_kernel.html
and
http://docs.1060.org/docs/3.0.0/book/solutiondeveloperguide/doc_entrypoint_guide.html

This will ensure a request is issued and executed before any external requests are admitted everytime the module is commissioned (i.e. every startup or cold restart)

Hope this helps, let me know if you have more questions,

Tony
Like · Post Reply
nk4um User
Posts: 111
April 10, 2006 10:33Module initialization
Dear all,

I would like to execute an active URI, e.g. a DPML script, the moment a module is loaded and before external connections are allowed. In this special case I want to check that some derivatives from my source data are created and already load them into the cache so also the first client requests get the proper performance. It looks like there are no provisions for this, at least I couldn''t find them in the documentations, but I hope I''m wrong ...

I''m aware of one partial solution and that is to add a cron entrypoint that is executed only once, but this job would be executed when external connections are already allowed and I rather wouldn''t block those for a "long" time.

Thanks in advance for any ideas,

Menzo Windhouwer[/i]
Like · Post Reply