Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Implement Scheduler Marcus Souza 6 luglio 2010 0.21
RE: Implement Scheduler Marcus Souza 6 luglio 2010 0.34
RE: Implement Scheduler Shuyang Zhou 6 luglio 2010 2.41
RE: Implement Scheduler Marcus Souza 6 luglio 2010 3.06
RE: Implement Scheduler Anna Steiglitz 7 luglio 2010 0.57
RE: Implement Scheduler Shuyang Zhou 7 luglio 2010 1.07
RE: Implement Scheduler Anna Steiglitz 7 luglio 2010 1.54
RE: Implement Scheduler Shuyang Zhou 7 luglio 2010 2.06
RE: Implement Scheduler kitie vbr 28 dicembre 2010 3.00
RE: Implement Scheduler Marcus Souza 7 luglio 2010 7.31
RE: Implement Scheduler Marcus Souza 7 luglio 2010 7.45
RE: Implement Scheduler Rob van Maris 15 luglio 2010 7.55
RE: Implement Scheduler Shuyang Zhou 19 luglio 2010 1.18
RE: Implement Scheduler Rob van Maris 15 luglio 2010 12.48
RE: Implement Scheduler Shuyang Zhou 19 luglio 2010 1.20
RE: Implement Scheduler Rob van Maris 19 luglio 2010 3.57
RE: Implement Scheduler Shuyang Zhou 19 luglio 2010 22.39
RE: Implement Scheduler Rob van Maris 20 luglio 2010 1.55
RE: Implement Scheduler Shuyang Zhou 20 luglio 2010 20.08
RE: Implement Scheduler Jelmer Kuperus 27 luglio 2010 7.55
RE: Implement Scheduler Amit Doshi 2 febbraio 2012 6.32
RE: Implement Scheduler Shuyang Zhou 2 febbraio 2012 15.58
RE: Implement Scheduler Rendi Januar 7 febbraio 2012 23.03
RE: Implement Scheduler Shuyang Zhou 7 febbraio 2012 23.11
RE: Implement Scheduler Rendi Januar 7 febbraio 2012 23.19
RE: Implement Scheduler Amit Doshi 8 febbraio 2012 0.00
RE: Implement Scheduler Alan Besco 25 febbraio 2013 13.28
Marcus Souza
Implement Scheduler
6 luglio 2010 0.21
Risposta

Marcus Souza

Punteggio: Junior Member

Messaggi: 58

Data di Iscrizione: 31 marzo 2009

Messaggi recenti

Hi,

I am following the Article to implement a Portlet X to run every sunday. I am getting a error "Unable to load the Scheduler class with the Portal class loader or the current context class loader" after i add following code in the Portal-ext.properties
1
2##
3##     Scheduling
4##
5       
6scheduler.enabled=true       
7scheduler.classes=Scheduler.class
8       


could someone point me in the right way to implement a class X with the Quartz Scheduler?
thanks in advance,
Marcus Souza
Marcus Souza
RE: Implement Scheduler
6 luglio 2010 0.34
Risposta

Marcus Souza

Punteggio: Junior Member

Messaggi: 58

Data di Iscrizione: 31 marzo 2009

Messaggi recenti

Both Code i am using:

 1
 2import com.liferay.portal.kernel.job.IntervalJob;
 3
 4public class Scheduler implements com.liferay.portal.kernel.job.Scheduler {
 5
 6        public void schedule() {
 7                this.schedule(new SyncDataJob());
 8            }
 9          
10            public void schedule(IntervalJob arg0) {
11                // TODO Auto-generated method stub
12            }
13
14            @Override
15            public void unschedule() {
16                // TODO Auto-generated method stub
17               
18            }
19       
20       
21        }


and

 1
 2
 3import org.apache.commons.logging.Log;
 4import org.apache.commons.logging.LogFactory;
 5import org.quartz.JobExecutionContext;
 6import org.quartz.JobExecutionException;
 7import com.liferay.portal.kernel.util.Time;
 8
 9public class SyncDataJob implements com.liferay.portal.kernel.job.IntervalJob{
10    public SyncDataJob() {
11        _interval = Time.MINUTE;
12    }
13    public long getInterval() {
14        return _interval;
15    }
16    public void execute(JobExecutionContext context)
17        throws JobExecutionException {
18        try {
19            ImportUser test = new ImportUser();
20            test.doImport();
21        }
22        catch (Exception e) {
23            _log.error(e);
24        }
25    }
26    private static Log _log = LogFactory.getLog(SyncDataJob.class);
27    private long _interval;
28    @Override
29    public void execute(com.liferay.portal.kernel.job.JobExecutionContext arg0)
30            throws com.liferay.portal.kernel.job.JobExecutionException {
31        // TODO Auto-generated method stub
32       
33    }
34}
Shuyang Zhou
RE: Implement Scheduler
6 luglio 2010 2.41
Risposta

Shuyang Zhou

LIFERAY STAFF

Punteggio: New Member

Messaggi: 9

Data di Iscrizione: 7 dicembre 2007

Messaggi recenti

You should use the new scheduler mechanism. It is introduced in LPS-4752. It works on top of MessageBus, so you need to make your job as a MessageListener and configure it in liferay-portlet.xml.

You can refer to liferay-portlet-app_6_0_0.dtd scheduler-entry, and in liferay-portlet.xml there are several examples you can follow.
Marcus Souza
RE: Implement Scheduler
6 luglio 2010 3.06
Risposta

Marcus Souza

Punteggio: Junior Member

Messaggi: 58

Data di Iscrizione: 31 marzo 2009

Messaggi recenti

Shuyang Zhou:
You should use the new scheduler mechanism. It is introduced in LPS-4752. It works on top of MessageBus, so you need to make your job as a MessageListener and configure it in liferay-portlet.xml.

You can refer to liferay-portlet-app_6_0_0.dtd scheduler-entry, and in liferay-portlet.xml there are several examples you can follow.


thankyou for the quick Answer! I will take a look at it.

Marcus Souza
Anna Steiglitz
RE: Implement Scheduler
7 luglio 2010 0.57
Risposta

Anna Steiglitz

Punteggio: New Member

Messaggi: 2

Data di Iscrizione: 7 luglio 2010

Messaggi recenti

Shuyang Zhou:
You should use the new scheduler mechanism. It is introduced in LPS-4752. It works on top of MessageBus, so you need to make your job as a MessageListener and configure it in liferay-portlet.xml.

You can refer to liferay-portlet-app_6_0_0.dtd scheduler-entry, and in liferay-portlet.xml there are several examples you can follow.


I have the same Problem. I have my own Portlet and want it to start every sunday. could you show please a step by step, how to achieve this.

Anna
Shuyang Zhou
RE: Implement Scheduler
7 luglio 2010 1.07
Risposta

Shuyang Zhou

LIFERAY STAFF

Punteggio: New Member

Messaggi: 9

Data di Iscrizione: 7 dicembre 2007

Messaggi recenti

For a complete example, go to plugin-trunk(svn://svn.liferay.com/repos/public/plugins/trunk
), check out test-misc-portlet. This is a very simple portlet, and it has a demo scheduler listener.

So basicly, in liferay-portlet.xml, add this:
 1<portlet>
 2        <portlet-name>1</portlet-name>
 3        <icon>/icon.png</icon>
 4        <scheduler-entry>
 5            <scheduler-event-listener-class>com.liferay.testmisc.messaging.TestSchedulerMessageListener</scheduler-event-listener-class>
 6            <trigger>
 7                <simple>
 8                    <simple-trigger-value>1</simple-trigger-value>
 9                    <time-unit>hour</time-unit>
10                </simple>
11            </trigger>
12        </scheduler-entry>
13        <friendly-url-mapper-class>com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper</friendly-url-mapper-class>
14        <friendly-url-mapping>test_misc</friendly-url-mapping>
15        <friendly-url-routes>com/liferay/testmisc/portlet/test-friendly-url-routes.xml</friendly-url-routes>
16    </portlet>


This means trigger TestSchedulerMessageListener every hour. You should add the scheduler logic into the MessageListener. Refer to the dtd for more trigger configuration info.
Anna Steiglitz
RE: Implement Scheduler
7 luglio 2010 1.54
Risposta

Anna Steiglitz

Punteggio: New Member

Messaggi: 2

Data di Iscrizione: 7 luglio 2010

Messaggi recenti

Shuyang Zhou:
For a complete example, go to plugin-trunk(svn://svn.liferay.com/repos/public/plugins/trunk
), check out test-misc-portlet. This is a very simple portlet, and it has a demo scheduler listener.

So basicly, in liferay-portlet.xml, add this:
 1<portlet>
 2        <portlet-name>1</portlet-name>
 3        <icon>/icon.png</icon>
 4        <scheduler-entry>
 5            <scheduler-event-listener-class>com.liferay.testmisc.messaging.TestSchedulerMessageListener</scheduler-event-listener-class>
 6            <trigger>
 7                <simple>
 8                    <simple-trigger-value>1</simple-trigger-value>
 9                    <time-unit>hour</time-unit>
10                </simple>
11            </trigger>
12        </scheduler-entry>
13        <friendly-url-mapper-class>com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper</friendly-url-mapper-class>
14        <friendly-url-mapping>test_misc</friendly-url-mapping>
15        <friendly-url-routes>com/liferay/testmisc/portlet/test-friendly-url-routes.xml</friendly-url-routes>
16    </portlet>


This means trigger TestSchedulerMessageListener every hour. You should add the scheduler logic into the MessageListener. Refer to the dtd for more trigger configuration info.


I tried to deploy the Portlet test-misc-portlet and got the error

08:41:55,059 INFO [PortletHotDeployListener:227] Registering portlets for test-
misc-portlet
08:41:55,512 ERROR [PortletLocalServiceImpl:542] com.liferay.portal.kernel.xml.D
ocumentException: Error on line 8 of document : Element type "scheduler-entry"
must be declared. Nested exception: Element type "scheduler-entry" must be decla
red.
com.liferay.portal.kernel.xml.DocumentException: Error on line 8 of document :
Element type "scheduler-entry" must be declared. Nested exception: Element type
"scheduler-entry" must be declared.
at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:377)
at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:388)
at com.liferay.portal.kernel.xml.SAXReaderUtil.read(SAXReaderUtil.java:1
56)


I am using LR 5.2.3 with Tomcat 6.0
Shuyang Zhou
RE: Implement Scheduler
7 luglio 2010 2.06
Risposta

Shuyang Zhou

LIFERAY STAFF

Punteggio: New Member

Messaggi: 9

Data di Iscrizione: 7 dicembre 2007

Messaggi recenti

5.2 does not have this feature. You should either upgrade or go back to use the old scheduler support. You can find example for old scheduler in 5.2's plugins repository
Marcus Souza
RE: Implement Scheduler
7 luglio 2010 7.31
Risposta

Marcus Souza

Punteggio: Junior Member

Messaggi: 58

Data di Iscrizione: 31 marzo 2009

Messaggi recenti

Shuyang Zhou:
You should use the new scheduler mechanism. It is introduced in LPS-4752. It works on top of MessageBus, so you need to make your job as a MessageListener and configure it in liferay-portlet.xml.

You can refer to liferay-portlet-app_6_0_0.dtd scheduler-entry, and in liferay-portlet.xml there are several examples you can follow.


I Finally was able to test it and it works fine! If i want to Schedule a task like

System.out.println("ok"); every 30 sec is not a Problem,

but if I do a object of my class X and try to use it, I become a ERROR

14:29:04,918 ERROR [TestPortlet:486] PermissionChecker not initialized
com.liferay.portal.security.auth.PrincipalException: PermissionChecker not initi
alized
at com.liferay.portal.service.base.PrincipalBean.getPermissionChecker(Pr
incipalBean.java:77)
at com.liferay.portal.service.impl.UserServiceImpl.getUserByEmailAddress
(UserServiceImpl.java:289)

 1
 2public class TestIntervalJob implements IntervalJob {
 3...
 4...
 5        if (_log.isInfoEnabled()) {
 6            _log.info("Execute");
 7            [b]TestPortlet as = new TestPortlet();[/b]
 8            try {
 9                [b]as.doImport();[/b]
10            } catch (PortletException e) {
11                // TODO Auto-generated catch block
12                e.printStackTrace();
13            }
14            
15        }


I am anyway a step further, thanks to you

Marcus Souza
Marcus Souza
RE: Implement Scheduler
7 luglio 2010 7.45
Risposta

Marcus Souza

Punteggio: Junior Member

Messaggi: 58

Data di Iscrizione: 31 marzo 2009

Messaggi recenti

Its done .... that Post helped me with the ERROR, thanks
Marcus Souza
Rob van Maris
RE: Implement Scheduler
15 luglio 2010 7.55
Risposta

Rob van Maris

Punteggio: New Member

Messaggi: 5

Data di Iscrizione: 16 giugno 2010

Messaggi recenti

Shuyang Zhou:
You should use the new scheduler mechanism. It is introduced in LPS-4752. It works on top of MessageBus, so you need to make your job as a MessageListener and configure it in liferay-portlet.xml.

You can refer to liferay-portlet-app_6_0_0.dtd scheduler-entry, and in liferay-portlet.xml there are several examples you can follow.


It would help if the DTD at that URL is updated. As it is it seems to be outdated and does not declare a scheduler-entry element.
Rob van Maris
RE: Implement Scheduler
15 luglio 2010 12.48
Risposta

Rob van Maris

Punteggio: New Member

Messaggi: 5

Data di Iscrizione: 16 giugno 2010

Messaggi recenti

Shuyang Zhou:
You should use the new scheduler mechanism. It is introduced in LPS-4752. It works on top of MessageBus, so you need to make your job as a MessageListener and configure it in liferay-portlet.xml.


Can you point me to more comprehensive documentation on the new scheduler mechanism?

I don't get the rationale for this design. Why do jobs need to be configured as part of a portlet (a hook seems more appropriate to me). And why reuse the MessageListener interface for this (the message does not seem to carry any information that is relevant to the job)?

I may be missing the point. Please explain.
Shuyang Zhou
RE: Implement Scheduler
19 luglio 2010 1.18
Risposta

Shuyang Zhou

LIFERAY STAFF

Punteggio: New Member

Messaggi: 9

Data di Iscrizione: 7 dicembre 2007

Messaggi recenti

Rob van Maris:
Shuyang Zhou:
You should use the new scheduler mechanism. It is introduced in LPS-4752. It works on top of MessageBus, so you need to make your job as a MessageListener and configure it in liferay-portlet.xml.

You can refer to liferay-portlet-app_6_0_0.dtd scheduler-entry, and in liferay-portlet.xml there are several examples you can follow.


It would help if the DTD at that URL is updated. As it is it seems to be outdated and does not declare a scheduler-entry element.


Our site maintainer will update it asap, for now you can refer the dtd from source code. They are update to date.
Shuyang Zhou
RE: Implement Scheduler
19 luglio 2010 1.20
Risposta

Shuyang Zhou

LIFERAY STAFF

Punteggio: New Member

Messaggi: 9

Data di Iscrizione: 7 dicembre 2007

Messaggi recenti

Rob van Maris:
Shuyang Zhou:
You should use the new scheduler mechanism. It is introduced in LPS-4752. It works on top of MessageBus, so you need to make your job as a MessageListener and configure it in liferay-portlet.xml.


Can you point me to more comprehensive documentation on the new scheduler mechanism?

I don't get the rationale for this design. Why do jobs need to be configured as part of a portlet (a hook seems more appropriate to me). And why reuse the MessageListener interface for this (the message does not seem to carry any information that is relevant to the job)?

I may be missing the point. Please explain.


Sorry, we don't have document for scheduler, but our training covers this topic.
It has to be tied to plugins(portlet, hook, web, etc), since the actual schedule logic may inside the plugin, you won't able to invoke it outside, like from another hook, unless you are doing some compplex classloader switching.

The main reason of using MessageBus for this new scheduler is avoiding classloading issues. And another benefit is, since MB is cluster aware(by using clusterlink bridging), your scheduler can transparently be clustered.
Rob van Maris
RE: Implement Scheduler
19 luglio 2010 3.57
Risposta

Rob van Maris

Punteggio: New Member

Messaggi: 5

Data di Iscrizione: 16 giugno 2010

Messaggi recenti

Shuyang Zhou:
Sorry, we don't have document for scheduler, but our training covers this topic.
It has to be tied to plugins(portlet, hook, web, etc), since the actual schedule logic may inside the plugin, you won't able to invoke it outside, like from another hook, unless you are doing some compplex classloader switching.


Hi Shuyang Zhou,

So how can I use the scheduler inside a hook when I need to configure it in a portlet?
Shuyang Zhou
RE: Implement Scheduler
19 luglio 2010 22.39
Risposta

Shuyang Zhou

LIFERAY STAFF

Punteggio: New Member

Messaggi: 9

Data di Iscrizione: 7 dicembre 2007

Messaggi recenti

Rob van Maris:
Shuyang Zhou:
Sorry, we don't have document for scheduler, but our training covers this topic.
It has to be tied to plugins(portlet, hook, web, etc), since the actual schedule logic may inside the plugin, you won't able to invoke it outside, like from another hook, unless you are doing some compplex classloader switching.


Hi Shuyang Zhou,

So how can I use the scheduler inside a hook when I need to configure it in a portlet?


You can not do that easily, it is not supposed to be used that way. The scheduler definition and configuration should be in same plugin. Once you schedule a job, you can not re-configure it, unless you cancel the previous one first, then re-schedule it again with new configuration. And this is not supported by standard xml declaration, you have to programly do it. If you also need to schedule a job from a different plugin, you have to switch the classloader yourself. I can not see why you need to do this, please re-consider your design, you may on the wrong way.
Rob van Maris
RE: Implement Scheduler
20 luglio 2010 1.55
Risposta

Rob van Maris

Punteggio: New Member

Messaggi: 5

Data di Iscrizione: 16 giugno 2010

Messaggi recenti

Hi Shuyang Zhou,

Let me restate my question - it looks like you understood it differently from what I meant.

So my question is: how can I use the scheduler inside a hook?
The context of this question is that Liferay allows me to configure a scheduler inside a portlet, but not inside a hook plugin.
Shuyang Zhou
RE: Implement Scheduler
20 luglio 2010 20.08
Risposta

Shuyang Zhou

LIFERAY STAFF

Punteggio: New Member

Messaggi: 9

Data di Iscrizione: 7 dicembre 2007

Messaggi recenti

Rob van Maris:
Hi Shuyang Zhou,

Let me restate my question - it looks like you understood it differently from what I meant.

So my question is: how can I use the scheduler inside a hook?
The context of this question is that Liferay allows me to configure a scheduler inside a portlet, but not inside a hook plugin.


Ok, i see your question now. Sorry for misunderstood it.

In hook, you need to use SchedulerEngineUtil directly, the api is very simple, so you should able to figure out how to use it.

I thinks it will make more sense for adding xml declaration of scheduler in hook too, we probably will add it in future.
Jelmer Kuperus
RE: Implement Scheduler
27 luglio 2010 7.55
Risposta

Jelmer Kuperus

Punteggio: Liferay Legend

Messaggi: 1192

Data di Iscrizione: 10 marzo 2010

Messaggi recenti

This is actually not that trivial

We tried starting the scheduler in a startup action and stopping in in a shutdown action.
But the shutdown action is never called. I created an issue for this

http://issues.liferay.com/browse/LPS-11613

Then we tried scheduling and unscheduling the job from a ServletContextListener however this fails when you restart the server, because it requires the messagebus and it is not available at that time.

com.liferay.portal.events.StartupAction starts it but our hook war is loaded before the ROOT war is loaded

So for now we decided on starting the scheduler in the startup action and shutting it down in a ServletContextListener.

Not very elegant for sure. The only other option i see is subclassing the HookHotDeployListener and adding the functionality to that

Can you suggest a cleaner solution ?
kitie vbr
RE: Implement Scheduler
28 dicembre 2010 3.00
Risposta

kitie vbr

Punteggio: Junior Member

Messaggi: 39

Data di Iscrizione: 5 agosto 2010

Messaggi recenti

Please I need help!!

I have to make a scheduler in version liferay 5.2.3

where can I find examples for scheduler for this version??

Some url for examples??

Thanks a lot
Amit Doshi
RE: Implement Scheduler
2 febbraio 2012 6.32
Risposta

Amit Doshi

Punteggio: Liferay Master

Messaggi: 549

Data di Iscrizione: 29 dicembre 2010

Messaggi recenti

Hi Shuyang Zhou,

We have to change the existing scheduler of LDAP.

By default in portal.properties they are providing properties ldap.import.interval.

I found that there is an entry in the liferay-portlet.xml

 1<portlet>
 2            <portlet-name>9</portlet-name>
 3            .
 4            .
 5            <scheduler-entry>
 6                  <scheduler-event-listener-class>com.liferay.portlet.admin.messaging.LDAPImportMessageListener</scheduler-event-listener-class>
 7                  <trigger>
 8                        <simple>
 9                              <property-key>ldap.import.interval</property-key>
10                              <time-unit>minute</time-unit>
11                        </simple>
12                  </trigger>
13            </scheduler-entry>
14            .
15            .
16      </portlet>


So, I tried to override that entry in the liferay-portlet-ext.xml in EXT Portlet with Cron Triggers.

 1<portlet>
 2            <portlet-name>9</portlet-name>
 3            .
 4            .
 5            <scheduler-entry>
 6                  <scheduler-event-listener-class>com.liferay.portlet.admin.messaging.LDAPImportMessageListener</scheduler-event-listener-class>
 7                  <trigger>
 8                        <cron>
 9                              <cron-trigger-value>0 10 1 ? * *</cron-trigger-value>
10                        </cron>
11                  </trigger>
12            </scheduler-entry>
13            .
14            .
15      </portlet>


The cron Trigger value( 0 10 1 ? * *) means that everday the import should start at 1:10:00 AM.

I checked the database in that it shows me the Entry in quartz_cron_triggers table, not in quartz_simple_triggers.

The problem is that above Cron Expression is working fine but Import is getting started two times (so at 1:10:00 AM two times LDAP import is getting started) instead of one time.

After Debugging code I found that two triggers are getting fired. One is Simple Trigger and other is Cron Trigger.

In one of the blog found that what you have mentioned in liferay-portlet-ext.xml will not override it will extend.
And if it is so then how can I override the entry of liferay-portlet.xml (SIMPLE Trigger to CRON Trigger).

Any help will be great.

Thanks in advance.
Shuyang Zhou
RE: Implement Scheduler
2 febbraio 2012 15.58
Risposta

Shuyang Zhou

LIFERAY STAFF

Punteggio: New Member

Messaggi: 9

Data di Iscrizione: 7 dicembre 2007

Messaggi recenti

So far, there is no clean way to swap a scheduler job.
But there are two ways to work around:
1) Comment the <scheduler-entry> tag in portal liferay-portlet.xml, completely switch the scheduler lanuching to your own ext plugin.
2) In your ext plugin, before launching your scheduler job, call SchedulerEngineUtil to explicitly remove default job first, then your scheduler job will be the only one.

1) is easier, but requires to modify portal side code, 2) requires one more line code, but is cleaner.
Rendi Januar
RE: Implement Scheduler
7 febbraio 2012 23.03
Risposta

Rendi Januar

Punteggio: New Member

Messaggi: 13

Data di Iscrizione: 6 dicembre 2010

Messaggi recenti

Hi Shuyang,

I would like to ask you about the scheduler, Can we implement 2 scheduler at the same time?
For example, I want first scheduler to do method A every 10 minutes and the second scheduler to do method B every 1 hour.
I already trying to add 2 scheduler entry taglib on liferay-portlet.xml, but it effect with no scheduler worked.

thanks,
Rendi
Shuyang Zhou
RE: Implement Scheduler
7 febbraio 2012 23.11
Risposta

Shuyang Zhou

LIFERAY STAFF

Punteggio: New Member

Messaggi: 9

Data di Iscrizione: 7 dicembre 2007

Messaggi recenti

Of course you can do that. In fact, you can as many as <scheduler-entry> for one portlet. See the portal liferay-portlet.xml for example, portlet 9 has two enties defined.
Rendi Januar
RE: Implement Scheduler
7 febbraio 2012 23.19
Risposta

Rendi Januar

Punteggio: New Member

Messaggi: 13

Data di Iscrizione: 6 dicembre 2010

Messaggi recenti

Shuyang Zhou:
Of course you can do that. In fact, you can as many as <scheduler-entry> for one portlet. See the portal liferay-portlet.xml for example, portlet 9 has two enties defined.


Okay I will try it, thanks a lot Zhou.
Amit Doshi
RE: Implement Scheduler
8 febbraio 2012 0.00
Risposta

Amit Doshi

Punteggio: Liferay Master

Messaggi: 549

Data di Iscrizione: 29 dicembre 2010

Messaggi recenti

Thanks Shuyang Zhou for the reply...

If I am implementing the first approach then it is working fine.

1) Comment the <scheduler-entry> tag in portal liferay-portlet.xml, completely switch the scheduler lanuching to your own ext plugin.

But the thing is that customer is not satisfied with it, removing the entry from the liferay-portlet.xml directly from the portal source.

They are asking for systematic way..

If I am overriding the liferay-portlet.xml with liferay-portlet-ext.xml and removing Particular LDAP Listener entry in liferay-portlet-ext.xml in EXT then also it is not working as aspecation.

why changing liferay-portlet-ext.xml is not working appropriately ?

And I tried other approach of yours

2) In your ext plugin, before launching your scheduler job, call SchedulerEngineUtil to explicitly remove default job first, then your scheduler job will be the only one.

On that I faced one problem..... Two times LDAP Import is Starting.

And one more thing I like to add is that Even I undeployed full EXT after applying 2nd approach. And trying to run normal functionality of LDAP as liferay is providing .. It was working in different manner.
The Problem i faced is that
1) Even the ldap.import.on.startup=false then also the import is getting started on Server Startup.
2) and if I keep ldap.import.on.startup=true then on Server Startup two times LDAP import is getting started.

Last 3 days I am trying to Identifying the issue what is happening behind the scene so that LDAP is starting two times... Not getting any clue.

I also tried with Fresh Liferay source... In the beginning it is working fine as normal LDAP Behaviour. But when I do some listener related changes in EXT and then deploying and undeploying it starting behaing abnormally(means runs two times LDAP Import ).

I am stuck on to this any help will be great.

Thanks in advance.
Regards,
Amit Doshi
Alan Besco
RE: Implement Scheduler
25 febbraio 2013 13.28
Risposta

Alan Besco

Punteggio: New Member

Messaggi: 1

Data di Iscrizione: 25 febbraio 2013

Messaggi recenti

that's strange, i tried your cod, with <cron-trigger-value>0 13,18 * * * ? </cron-trigger-value> and i recieve my notification (it's what the cron job trigger) every hour at h:13 min and h:18 min then i tried, <cron-trigger-value>0 0 13,18 * * ? </cron-trigger-value> and now, like wished, the notification are sent every day at 13:00 and 18:00.

Any idea why my first * represent the second ?

thanks