Unfortunately, no I didn't find a good way to do this. At one point I had my
scheduler bean running but I hadn't figured out how to be sure that it was
using the same classloader as my portlet.
Since my cache refresh was under 10 seconds we decided to let one user per day
take the 'hit' and table the issue. In the future when we are using EJBs I'll
revisit this.
Here is a very simple timer example:
CacheDumpScheduler.java:
package com.foo;
|
| import java.util.Date;
|
| import org.jboss.varia.scheduler.Schedulable;
|
| public class CacheDumpScheduler implements Schedulable {
|
| public void perform(Date now, long remainingRepetitions) {
| MyPortlet.resetCache();
|
| }
|
|
| }
META-INF/jboss-service.xml:
<?xml version="1.0" encoding="UTF-8"?>
| <server>
| <mbean code="org.jboss.varia.scheduler.Scheduler"
name="com.foo:service=CacheDumpScheduler">
| <attribute name="StartAtStartup">true</attribute>
| <attribute name="SchedulableClass">
| com.foo.CacheDumpScheduler
| </attribute>
| <attribute name="SchedulableArguments">
| </attribute>
| <attribute name="SchedulableArgumentTypes">
| </attribute>
| <attribute name="InitialStartDate">NOW</attribute>
| <attribute name="SchedulePeriod">6000</attribute>
| <attribute name="InitialRepetitions">-1</attribute>
| <depends>jboss.web:service=WebServer</depends>
| </mbean>
|
| </server>
Hope that helps
Jon
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4003389#4003389
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4003389
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user