Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7798901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:08:04+00:00 2026-06-02T00:08:04+00:00

So I have somewhat limited experience with serialization, Wicket, and multi thread projects so

  • 0

So I have somewhat limited experience with serialization, Wicket, and multi thread projects so bear with me.

Essentially my web application class is instantiating a POJ (parentObject) which creates a starts a new timer and instantiates several POJs (childObjects) that also have timers in them. These childObjects are stored in a list in the parentObject class. Pages in my wicket application need to access parentObject, so I made it accessible as so:

public Object getParentObject
{
   return this.parentObject;
}

And it is retrieved in each page like so:

((MyApplication)Application.get()).getParentObject()

The problem currently is that the timertask for both the parentObject and childObjects are no longer being called every minute as they should be. My logs pick up the first start of the parentObject, but the logging message is never outputted again signalling that the run() method of parent Object’s timertask is not being executed every minute. The same holds true for the child Objects. It seems like the timers are only being executed once. Below is some pseudocode for what I have

public class childObject implements Serializable
{
    private transient NamedParameterJdbcTemplate njt;
    private transient Timer timer;

    public childObject(DataSource ds)
    {
        this.njt = new NamedParamterJdbcTemplate(ds);
    }

    public void start()
    {
        timer = new Timer();

        timer.schedule(new TimerTask(){

            public void run()
            {
                //do some stuff that is never happening
            }

        }, 0, 60000);
    }
}

public class ParentObject implements Serializable
{
    private DataSource ds;
    private List<ChildObject> childObjects;
    private transient Timer;

    public ParentObject(DataSource ds)
    {
        this.ds = ds;
        //add some stuff to childObjects

        timer = new Timer();

        timer.schedule(new TimerTask(){

            public void run()
            {
                for(some condition)
                {
                    //Do some stuff

                    if(/*condition is met*/)
                    {
                             //starts the child's timer to do stuff
                        childObjects.get(i).start();
                    }
                }
            }

        }, 0, 60000);
    }
}

public MyApplication extends WebApplication
{
    private ParentObject object;
    private DataSource ds;

    public void init()
    {
        super.init();

        ApplicationContext context = new ClassPathXmlApplicationContext("/applicationContext.xml");
        ds = (DataSource) context.getBean("dataSource");

        parentObject = new ParentObject(ds);
    }
}

Do I even need to make these objects Serializable? The objects themselves are never being attached to wicket components, although String, integer, Date sorts of variables that are members of their classes are.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T00:08:06+00:00Added an answer on June 2, 2026 at 12:08 am

    Wicket is fundamentally single threaded (as are most good GUI frameworks due to the difficulty of getting multithreading right) and you should avoid instantiating tasks. (Marking the Timer as transient will mean it gets lost upon deserialization by the way, which might be the cause of your problems)

    You should rearchitect your application to have a service layer which is accessed by Wicket components on demand, possibly using LoadableDetachableModels. The service layer can have tasks and so on, as it will be managed by Spring rather than Wicket.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a somewhat-long-running stored procedure being called from a PB application. I want
I currently have a web-application that implements a rudimentary form of ACL using UNIONs
I have a web application that uses a relational database (MySQL). We're adding a
I have an application where users have somewhat of a settings page, and some
I have somewhat simple problem with my Flash projects. I've installed Flash CS5, created
I have somewhat interesting development situation. The client and deployment server are inside a
Does VS2008 have somewhat C++0x standard support? DUPLICATE Visual Studio support for new C
UPDATE: I have somewhat resolved the issue. Just in case if anyone runs in
I have a somewhat messily-formatted Objective-C code base. Is there a way to have
I have a somewhat complicated branching structure at work (at least for me). It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.