Oki DZ wrote:
>
> On Wed, 15 Aug 2001, Berin Loritsch wrote:
>
> > I added a new package in Excalibur that will be used for
> > monitoring resources. There will be two monitors: passive
> > and active. The passive monitor will rely on the Resources
> > themselves to keep up to synch. This is not that exciting,
> > but easy to write. The second is an Active Monitor. The
> > Active Monitor will issue one or more threads to examine
> > the group of resources based on the policies used. When
> > a Resource has changed, it will propogate that change to
> > all PropertyChangeListeners examining the resource.
>
> This would be great (the active one); I think James would surely need,
> especially James which is setup to use database repositories. Currently,
> I'm having problems with run-out database connections. I'd like to be able
> to monitor the number of the database connections used and also the
> delivery threads that utilize those connections. The monitor thread(s)
> could see whether the connections used have reached a certain threshold,
> and would kill some of the delivery threads until the connections used are
> below the safe number. (It would be nice to be able to kill "low-priority"
> threads first; ie: the ones which handles email with certain sender
> addresses, but this is James implementation problem, I think.)
The Excalibur Connection pooling code allows you to provide your own
"line test"
query. For many databases this can be as simple as "SELECT 1" or
"SELECT 1
FROM DUAL", but for some (like Informix) you need to specify something
yourself.
If you use that, you will be guaranteed that the Connection you receive
will
always be good.
Although--refactoring the Connections so that they are actively
monitored
would be good. That way the test for an active connection can be
removed from
the getConnection() method improving performance.
> BTW, it would be great also if the Monitor runs relatively decoupled with
> the (blocks) it monitors. It should be the case, I think. Say, in case of
> James, the Monitor could suspend James for a while when the database
> server is not available. I believe there would be little changes in James
> to utilize such monitor, all it needs is just to register to the Monitor
> with resources to be monitored, and also some listeners that should be put
> into place.
It does. ActiveMonitor is a Component that runs in its own Thread
(currently set
to the lowest priority). All monitored resources must extend the
Resource
abstract class (although the Resource could be made into an interface).
> > This opens up a whole new realm to the Caching implementation,
> > which can confidently serve old content until it is told there
> > is new information. In fact, it can continue to serve the older
> > content until the new information is loaded into the cache.
>
> Having a global cache (which is an Avalon block) would be neat, I believe.
> I'd like to have global caches that are easily to set up; ie: via the
> config.xml, something like:
> <config>
> <my-global-caches>
> <cache name="mycache1">
> <!-- some parameters you can think of here -->
> </cache>
> <cache name="mycache2">
> <!-- these too -->
> </cache>
> </my-global-caches>
> </config>
>
> Each cache shoud be a singleton, I think; otherwise, it wouldn't be global
> one, right? And due to how easy it is to create a thread in Java, the
> caches should be threadsafe. Then from the components that use any of the
> caches, all what's needed is just to use the component selector to get the
> right cache by the name.
Excalibur does have a Cache in Scratchpad (i.e. under development). It
is
used like a Component.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]