Package org.eurekastreams.commons.client

Examples of org.eurekastreams.commons.client.ActionProcessor


    private void runTimerJobs()
    {
        Date now = new Date();
        long nowMs = now.getTime();
        boolean anyJobsRun = false;
        ActionProcessor actionProcessor = Session.getInstance().getActionProcessor();

        for (int numMinutes : jobs.keySet())
        {
            // has it been more that numMinutes since this batch last ran?
            Date lastRun = lastRunTimes.get(numMinutes);
            boolean okToRun = true;
            if (lastRun != null)
            {
                long deltaSec = (nowMs - lastRun.getTime()) / MS_IN_SEC;
                long requiredSec = numMinutes * SEC_IN_MIN - TIMER_MERCY_SEC;
                okToRun = deltaSec >= requiredSec;
            }

            if (okToRun)
            {
                for (String job : jobs.get(numMinutes))
                {
                    if (!anyJobsRun)
                    {
                        anyJobsRun = true;
                        actionProcessor.setQueueRequests(true);
                    }

                    try
                    {
                        if (fetchables.containsKey(job) && !pausedJobs.contains(job))
                        {
                            fetchables.get(job).fetch(requests.get(job), false);
                        }
                    }
                    catch (Exception ex)
                    {
                        // Just making sure ANYTHING that goes wrong doesn't hose the entire app.
                        int x = 0;
                    }
                }

                // mark this batch as having run (using the base
                lastRunTimes.put(numMinutes, now);
            }
        }

        if (anyJobsRun)
        {
            actionProcessor.setQueueRequests(false);
            actionProcessor.fireQueuedRequests();
        }
    }
View Full Code Here


     * Tests accepting the terms of service with success.
     */
    @Test
    public final void acceptTermsOfServiceSuccessTest()
    {
        final ActionProcessor processorMock = context.mock(ActionProcessor.class);

        final AnonymousClassInterceptor<AsyncCallback<Serializable>> acceptCallBackInt =
            new AnonymousClassInterceptor<AsyncCallback<Serializable>>();

        context.checking(new Expectations()
View Full Code Here

     * Tests accepting the terms of service with failure.
     */
    @Test
    public final void acceptTermsOfServiceFailureTest()
    {
        final ActionProcessor processorMock = context.mock(ActionProcessor.class);

        final AnonymousClassInterceptor<AsyncCallback<Serializable>> acceptCallBackInt =
            new AnonymousClassInterceptor<AsyncCallback<Serializable>>();

        context.checking(new Expectations()
View Full Code Here

TOP

Related Classes of org.eurekastreams.commons.client.ActionProcessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.