Implementing scheduler

hi all.i need help on this issue..
this is my web.xml
<servlet>
<servlet-name>ApplicationService Servlet</servlet-name>
<servlet-class>ljt.view.servlet.ApplicationService</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
this is my ApplicationService.java
public class ApplicationService extends HttpServlet {
public void init(ServletConfig config) throws ServletException {
super.init(config);
ScheduleRegClean();
public void ScheduleRegClean() {
Timer timer = new Timer();
Calendar date = Calendar.getInstance();
System.out.println(date.getTime());
Calendar current = new GregorianCalendar();
Calendar cal = new GregorianCalendar(current.get(Calendar.YEAR), 0, 31);
System.out.println("SET " + cal.getTime());
if (cal.getTime().equals(new Date()) || cal.getTime().after(new Date())){
timer.schedule(new RegClean(), cal.getTime(), 1000 * 60 * 60 * 24 * 7 * 365); // Schedule to run every 1 year
and this is my RegClean.java
public class RegClean extends TimerTask{
public void run() {
SchedulerServiceImpl am = (SchedulerServiceImpl)AppModuleFactory.getAppModule("ljt.model.scheduler.SchedulerService", "SchedulerServiceLocal");
String sqlRegClean;
sqlRegClean = "UPDATE LJT_LS SET STATUS_ID=2 WHERE STATUS_ID=1 AND EXPIRY_DATE < SYSDATE;\n" +
"UPDATE LJT_LS_ASST SET STATUS_ID=2 WHERE STATUS_ID=1 AND LS_ID IN (SELECT LS_ID FROM LJT_LS WHERE STATUS_ID=2);";
System.out.println("sqlRegClean = " + sqlRegClean);
am.getDBTransaction().executeCommand(sqlRegClean);
am.getDBTransaction().commit();
my problem is how can i set this job to run on 31st January every year..?

hi frank. thanks for reply. that's why i using 1000 * 60 * 60 * 24 * 7 * 365 is not the good solution. do u have any suggestion for my job. i want to schedule this job on 31/01 for the current year.
ublic class RegClean extends TimerTask{
public void run() {
SchedulerServiceImpl am = (SchedulerServiceImpl)AppModuleFactory.getAppModule("ljt.model.scheduler.SchedulerService", "SchedulerServiceLocal");
String sqlRegClean;
sqlRegClean = "UPDATE LJT_LS SET STATUS_ID=2 WHERE STATUS_ID=1 AND EXPIRY_DATE < SYSDATE;\n" +
"UPDATE LJT_LS_ASST SET STATUS_ID=2 WHERE STATUS_ID=1 AND LS_ID IN (SELECT LS_ID FROM LJT_LS WHERE STATUS_ID=2);";
System.out.println("sqlRegClean = " + sqlRegClean);
am.getDBTransaction().executeCommand(sqlRegClean);
am.getDBTransaction().commit();
thank you

Similar Messages

  • What is the best practice for implementing scheduled tasks in ADF?

    Hi experts,
    I'm using Jdev 12.1.3, and I'd need your advice in how implement scheduled tasks.
    We have today a button that generates a Jasper pdf report correctly. The new requirement is to schedule a task that automatically send this pdf via email once a week.
    Thanks in advance for your help.
    Best regards,
    Jose.

    Refer
    Andrejus Baranovskis Blog: Optimizing Long Running ADF Operations with Parallel WebLogic Time Manager Execution
    http://www.gebs.ro/blog/oracle/timer-task-in-adf/
    https://technology.amis.nl/2011/10/19/adf-faces-handle-task-in-background-process-and-show-real-time-progress-indicator-…

  • Oracle BI Enterprise Edition - How to implement "Scheduling Services"

    hi,
    Currently doing some analysis of OBIEE for project specification doc.
    Please help me for the below need.
    1. How to implement "Scheduling Services" in OBIEE , terms of;
    a.Integration with 3rd party schedulers
    b.Job management
    c.Job scheduling
    d.Notifications
    reg,kannan
    Edited by: user4810433 on Nov 13, 2008 8:59 PM

    hi,
    try this below links
    http://www.oracle.com/technology/obe/obe_bi/bi_ee_1013/delivers/delivers.htm
    http://oraclebizint.wordpress.com/2007/09/13/oracle-bi-ee-10133-configuring-delivers-ibots/
    Regards
    Naresh
    Edited by: Naresh Meda on Nov 13, 2008 9:03 PM

  • How to implement schedule workflow using SharePoint Designer?

    Hi All,
    Please let me know , How to implement the schedule workflow using Share Point Designer.
    Thank You.
    Regards,
    ~Sri

    +1 to this. The closest that you'll get with list / level features is using Information Rights. You can trigger workflows based on time/date columns, which may serve your needs.
    Failing that, you will indeed need a custom timer job.
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • Safety stock not covered by schedule lines in planning run

    Hi !
    In our organization we are trying to implement scheduling agreements and automatic creation of delivery schedule lines through MRP. We have MRP type PD and it considers the reservations created by PM orders and Production orders as requirement elements. When I do the planning run, it creates schedule lines for the PM order reservations and purchase requisition for safety stock. I need it to create schedule lines for all scenarios. Kindly help and suggest a solution.
    Regards,
    Satya

    Hi,
    Please refer the below links.
    Schedule Lines not getting created in MRP
    Re: No Scheduling line is generated when RUN MRP
    Hope it helps you.
    Thanks.

  • Creation of InitialContext fails when i hot-deploy scheduler-service.xml

    Creation of InitialContext fails when i hot-deploy scheduler-service.xml
    I configured scheduler-service as follows in Jboss 3.2:
    scheduler-service.xml
    <mbean code="org.jboss.varia.scheduler.Scheduler"
         name=":service=Scheduler">
    <attribute name="StartAtStartup">true</attribute>
    <attribute name="SchedulableClass">com.beta.my.utils.FMScheduler</attribute>
    <attribute name="SchedulableArguments">Schedulabe Test,12345</attribute>
    <attribute name="SchedulableArgumentTypes">java.lang.String,int</attribute>
    <attribute name="InitialStartDate">0</attribute>
    <attribute name="SchedulePeriod">10000</attribute>
    <attribute name="InitialRepetitions">-1</attribute>
    </mbean>
    Schedulable Class
    package com.beta.my.utils;
    import java.util.Date;
    import org.jboss.varia.scheduler.Schedulable;
    public static class FMScheduler
    implements Schedulable
    private String mName;
    private int mValue;
    public FMScheduler(String pName,int pValue)
    mName = pName;
    mValue = pValue;
    public void perform(Date pTimeOfCall,long pRemainingRepetitions)
    try {
              Context context = new InitialContext();//properties taken from jndi.properties file
              } catch (Exception e){
                   e.printStackTrace();
    I started my jboss..,FMScheduler created successfully, perform method in FMScheduler called succesfully after SchedulePeriod(1000)
    The problem occurs(NullPointerException) while i changed SchedulePeriod time and hot-deployed(just saved scheduler-service.xml).
    The following Exception occures due to InitialContext creation fails*(Context context = new InitialContext();)* in FMScheduler.
    17:46:27,361 ERROR [STDERR] java.lang.NullPointerException
    17:46:27,361 ERROR [STDERR] at org.jboss.mx.loading.UnifiedClassLoader.findR
    esources(UnifiedClassLoader.java:374)
    17:46:27,361 ERROR [STDERR] at java.lang.ClassLoader.getResources(ClassLoade
    r.java:825)
    17:46:27,361 ERROR [STDERR] at com.sun.naming.internal.VersionHelper12$5.run
    (VersionHelper12.java:145)
    17:46:27,361 ERROR [STDERR] at java.security.AccessController.doPrivileged(N
    ative Method)
    17:46:27,377 ERROR [STDERR] at com.sun.naming.internal.VersionHelper12.getRe
    sources(VersionHelper12.java:142)
    17:46:27,377 ERROR [STDERR] at com.sun.naming.internal.ResourceManager.getAp
    plicationResources(ResourceManager.java:468)
    17:46:27,377 ERROR [STDERR] at com.sun.naming.internal.ResourceManager.getIn
    itialEnvironment(ResourceManager.java:159)
    17:46:27,377 ERROR [STDERR] at javax.naming.InitialContext.init(InitialConte
    xt.java:215)
    17:46:27,377 ERROR [STDERR] at javax.naming.InitialContext.<init>(InitialCon
    text.java:195)
    17:46:27,377 ERROR [STDERR] at com.beta.my.utils.FMScheduler.perform
    (FMScheduler.java:42)
    17:46:27,392 ERROR [STDERR] at org.jboss.varia.scheduler.Scheduler$Listener.
    handleNotification(Scheduler.java:1263)
    17:46:27,392 ERROR [STDERR] at org.jboss.mx.server.NotificationListenerProxy
    .handleNotification(NotificationListenerProxy.java:69)
    17:46:27,392 ERROR [STDERR] at javax.management.NotificationBroadcasterSuppo
    rt.sendNotification(NotificationBroadcasterSupport.java:95)
    17:46:27,392 ERROR [STDERR] at javax.management.timer.Timer.sendNotification
    s(Timer.java:441)
    17:46:27,392 ERROR [STDERR] at javax.management.timer.Timer.access$000(Timer
    .java:31)
    17:46:27,408 ERROR [STDERR] at javax.management.timer.Timer$RegisteredNotifi
    cation.doRun(Timer.java:612)
    17:46:27,408 ERROR [STDERR] at org.jboss.mx.util.SchedulableRunnable.run(Sch
    edulableRunnable.java:164)
    17:46:27,408 ERROR [STDERR] at org.jboss.mx.util.ThreadPool$Worker.run(Threa
    dPool.java:225)
    please help me if u have any idea,thanks

    Hi Hamsa,
    Did you also create and configure an "Execution Destination"?
    You can test the Metadata destination configuration on Web Service Navigator.
    On the web service navigator (http://hostname:portnumber/wsnavigator) search in the metatda destination you have created for the service you imported in web dynpro as a model. If you can find it there test it on the ws navigator.
    Best regards,
    Yasar

  • Reporting ME31 L Scheduling Agreements in Me2M

    At my company were having a deli ma where I've implemented scheduling agreements in SAP R3.  Its going great until we ran a report in ME2M. We report to the CFO expected delivery of incoming materials. Through ME2m and filtering  ALLES "everything possible" it adds up the PO's but when it adds up the scheduling agreement schedules it multiply all lines in the schedule against the total open on all the schedules. Why?
    Example
    PO                        Line     Due                 QTY      Unit price  Total             Cumulative Total
    PO 773002121       100     8/1/2011        10            10.00       $100.00        $100
    PO 773002121        200    9/1/2011         20           10.00      $200,00         $200
    My Problem
    PO                        Line     Due                 QTY      Unit Price          Total        Cumulative Total
    SG 777300212       100     8/1/2011        20            10.00     $100,000        $100,000
    SF 777300212         200     9/1/2011       20             10.00    $100,000         $100,000
    Why does it multiply the header or the 10 X the total value of the schedule. 
    Resulting in a false positive that throws off the financials. The CFO thought i ordered 10 million dollars worth of material.
    I know the fix is as simple as creating a special report or encouraging the person runing the report to multiply in excel the qty per schedule to per unit price. But I upset someones process flow and they have vowed to pull scheduling agreements down if I can't get this fixed.
    Any one ever experience this. What did you do to fix it. This wasn't a problem running scheduling agreements at HP or L-3 or at Boeing. But at this new place .. .  . .
    They want Me2m to run with out any manipulation and add up the line totals .
    Any help would be appreciated. I've put in 10 months of my life introducing scheduling agreements to this origination.
    It would be a shame if a reporting aspect of Me31L brought all the cards tumbling down and 10 months of my life to go up in smoke.
    Edited by: nick123 on Aug 12, 2011 8:28 AM
    Edited by: nick123 on Aug 12, 2011 8:31 AM

    Check decimals no luck.
    The accounting person is using alles so they can drop the report from Me2m into excel.
    Help the noose around my neck tightened on me. Dealing with a group of very difficult to work with individuals and unless you can make ME2M add up the totals right you will have to discontinue.
    Any run into this?
    Here is a image of the reporting problem
    [img]http://farm7.static.flickr.com/6156/6142492113_b6d847e46e_b.jpg[/img]
    Here is my varient which was turned down.
    [img]http://farm7.static.flickr.com/6192/6143045190_5fec837d38_b.jpg[/img]
    Edited by: nick123 on Sep 13, 2011 6:50 AM
    Edited by: nick123 on Sep 13, 2011 6:52 AM

  • How to implement sheduling services in Ep

    Hi all,
    I would like to know how to implement scheduling services in ep in the sense .. running jobs in portal .
    Any pointers to this would be of great help.
    Thanks& Regards,
    Uma,

    Hi Uma,
    If you have not already done so, try the following weblog by Prakash.
    <b>Did you know you can schedule jobs in portal using KM's Scheduler Task?>
    Hope this helps you
    Ranjith

  • Dispatcher count values for scheduling downtime in oracle b2b 11g

    Hi all,
    I would like to know if anyone has implemented scheduling in oracle b2b. Please share your suggestions.
    1) What should be the value for 'Outbound Dispatcher Count' & 'Inbound Dispatcher Count' in case of outbound & inbound transactions for large transactions. How do we define this value? Can you give some ratio for this value to this number of transactions? Currently we expect around 8000 messages to flow in span of two hours.
    2) What could be the performance issues that we can come across if any after we are done with this setup ?
    Thanks

    8000 messages in 2 hours is not a huge load. Please set the below values before configuring downtime -
    Outbound Dispatcher Count = 1
    Auto Stack Handler= true
    Auto Stack Handler Interval= 1
    'Inbound Dispatcher Count' is not used for downtime feature.
    There will be no impact on performance.
    Regards,
    Anuj

  • Scheduling Agreement Localization SAP Brasil

    Hi Experts
    I need to implement scheduling Agreemnt in Brasil but I haven't found the settings of LPLB (item of document type COB) in fact I don't know if there is some upgrade or some SAP note for that appears in the system automatically the document type LP - LPN, COB - LPLB beacuse in this moments is misses, Our version of SAP is 6.0. Or I should create manually.
    Thanks in advance

    Hi,
    Contracts and scheduling agreements are treated alike in SPM.  So use contracts data type to load your data.
    Rohit

  • Negative timemanagement Implementation

    Hi Guru,
    I have been asked to provide the solution for the below proposal,
    There is a request for proposal for u201CNegative Time Management implementation  on SAP HR with ESS and MSS Functionalityu201D.Below are details 
    1.       The Workflows need to cover Leave approval Process Flow, Leave Balance enquiry, Update to Work Schedule Rules, Display of Holiday Calendar etc. with payment integration to Payroll..
    2.       It needs to be rolled out in 70 Countries with Local Flavour.
    3.       i have to propose the best possible solution on SAP HCM to achieve this using maximum SAP Standard Functionality with minimum Customization.
    4.       The proposed Go Live is july 2012 hence an aggressive Implementation schedule with competitive pricing will be most welcome.    
    I want to mention the no. of resources with their respective skills ,can any one guide me on this..which particular resources would be required ,or do i need to suggest each individual resource like,one Workflow,one EP etc..
    Regards,
    Krish

    Hi,
    As per standard practice, it is not recommended to use negative stocks. It may result in serious inventory control issues. Since you will continue to do GI for raw materials etc. irrespective of stock availability.
    You can avoid COGI by following way :
    In OPK4 Production Order confirmation parameters select your respective production order types go to Individual Entry General tab where you need to maintain tick in check boxes Goods Movements & Termination of Incorrect Goods Movements under Error Handling / Logs tab.
    This practice will help you incorrect goods movement going to COGI and also prevent confirmation without proper goods movements.
    Hope this helps.
    Regards,
    Tejas

  • Quartz Scheduler

    Hi all ,
    We have a requirement to implement Scheduler to our BPEL Processes ,
    Can any one help me out in this .
    Any document for Quartz Scheduler .
    Thanks,
    Karthik

    The pdf document from Oracle suggests putting the scheduler on Admin server, maybe because the developer was using SOA Suite for developers.
    However, if we have Admin Server and SOA Server separate (typically the case in an organisation), then is it advisable to deploy the scheduler on SOA Server instead of Admin server. Has anybody faced any issues.
    Thanks in advance.

  • Service P o - Big Bang Implementation

    Hi all,
    whatz Big bang implementation methodology?
    -Service PO-
    when i save the shipment cost document VI01-
    system automatically generating Servie entry sheet -SES for the Serive PO -
    can any one tell me -
    hwo the system generating this SES automatically?
    where is the control?
    reward points, if helpful

    Big Bang:-
    One of the difficult decisions of an ERP implementation is the implementation strategy: do you take the big bang approach and get it done with quickly, or do you slowly phase in new processes and technology over time?
    The answer is that it depends. The appeal of the big bang implementation strategy is that it focuses the organization for an intense and relatively shorter period of time than if the project were phased. This often helps address long-term resource shortages. It also condenses the pain and difficulty of an ERP project into a shorter period of time, although the pain is typically more pronounced using this approach.
    The downside of the big bang implementation approach is that the project is often rushed, details are overlooked, and changes to business processes may not be the best ones for the organization. And, as mentioned above, the pain is often more severe due to the hectic nature of this approach. More often than not, my experience has been that projects that implement an overly aggressive big bang approach are more risky and result in less satisfaction with the system's abilities to meet important business requirements.
    The other end of the spectrum is to follow a slower, phased approach. This can either by functional business area or geography. The appeal here is that is allows project teams to take their time in the planning, customization, and testing of the system while continuing with day-to-day jobs.
    The downsides are that these types of phased projects often lack the urgency and focus of a big-bang project. It can also lead to "change fatigue," which can cause employees to become burned out on constant change. Instead of getting the project over with in a shorter period of time, these projects involve constant change over longer periods, which can be draining to employees.
    So which approach is the best? Both approaches have their clear pros and cons. At the end of the day, it is important to find a balance between both that works best for your organization. Implementation schedules need to be aggressive, but not to the extent that they cause you to overlook important details or make sub-par decisions. It is often helpful to do the project in multiple (but aggressive) phases to help focus the organization and create a sense of urgency. These details should be carefully outlined as part of your ERP Project Planning Approach.

  • Scheduling alternative to Timer

    Hi,
    I have a server instance which runs on JVM 1.2. I can't upgarde it to JVM 1.3 and above too. So I cannot implement scheduling using the Timer class.
    What are the other options I have to implement a scheduling task in java . Let say i want to print "Hello JAVA" every day.
    Thanks
    jigo

    Let say i want to print "Hello JAVA" every day.
    new Thread() {
        public void run() {
            while (true) {
                try {
                    // The "24" here is really "24L" to avoid overflow. The forum
                    // software in its infinite wisdom clips off the "L".
                    Thread.sleep(24L * 60 * 60 * 1000);
                    System.out.println("rhubarb");
                } catch (Throwable e) {
                    ...log the exception...
    }.start();If you need to do it at e.g. midnight: calculate the time until the next midnight and sleep that amount. Oh, what the heck:
        public static void sleepModulo(long milliseconds, long minimum_sleep)
            long now = System.currentTimeMillis();
            long then = now / milliseconds * milliseconds + milliseconds;
            long sleep = then - now;
            if (sleep < minimum_sleep)
                sleep += milliseconds;
            if (sleep == 0)
                return;
            try {
                Thread.sleep(sleep);
            } catch (InterruptedException e) {
                // ignore
        }Your operating system might not like if you start hundreds of threads. So if you have hundreds of tasks you may want to write a Timer class yourself. Or google, someone has probably done one already. If you just have a few tasks you can use individual threads.

  • Schedules in Contracts

    Hi all!
    Please help. I'm trying to understand how to implement schedules of materials to arrive and payments to purchasing contracts.
    I need some 'document' where I could specify these schedules for reason of planning and control.
    Well, schedule of reciepts is in Purchase Orders. But how can I specify payments schedule, which IS in real paper contract and which can be fully different from reciepts'?
    (I'm just learning OEBS, so pls be patient :) )

    Hi,
    For contracts we have seperate pricing procedure. It will depend upon the pricing procedure determination, by which the document pricing procedure will be assigned to Cus PP + Sales area + Pr. Pro.
    Normally for contracts the Doc Pricing procedure will be different from normal sales documents. If you want to have a release order to pick diff pricing procedure, the you change the doc pricing procedure of the release order and assigne it to the respective pricing procedure.
    Prase

Maybe you are looking for

  • Problems in RFC Sender adapter

    Hello I am having a scenario where I am sending the message through RFC sender. The message is getting posted on integration server but its giving error in SXMB_MONI. The error says "HTTP response contains status code 503 with the description Service

  • Why is Elements crashing Upon start-up?

    Hello. I am using Photoshop Elements 2 for Macs with a G5 PowerPC iMac and OS 10.4.11. I've been using Elements for several years without a problem.I recently re-installed my OS from OS 10.4.9 to OS 10.4.11 and then reinstalled Elements. At the end o

  • Aaa max failed attempts/RADIUS

    Is there an aaa command or server command that limits the maximum number of failed attempts one can try before getting cut off. I note there is one for local. but I fail to find one that applies to aaa that is auth against radius. am I missing somthi

  • Plant Creation.

    Hi All, Can somebody provide me with a List of Steps for : Creation of Plant, assignment, and all relevant settings related to that to be done in system for all standard scenarios in MM for that Plant (Like Creation of Master data , Quality Inspectio

  • JCO monitor creation error

    Hi all, I'm trying to configure the Mobile administrator. For this I've followed all the steps in the SAP library regarding this. But, when I try to activate the two JCO monitors: ME_MONITORS_MODELDATA_DEST and ME_MONITORS_METADATA_DEST, I simply can