Announcement Announcement Module
Collapse
No announcement yet.
Asyncronous (???) Beans Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Asyncronous (???) Beans

    Hi,

    Out of curiosity, is there any possibility, to create some kind of Spring's bean, which will be asyncronous, or kind of that?

    I need to be able to do big processing (mailing, fetching/rebuilding huge data base part, etc.) in "background", without blocking process until it will finish. Any chances I can do that with Spring?

    Thanks!

  • #2
    A bean cannot be inherently "asynchronous". You can only access bean methods concurrently, and so allow for asynchronous operations.
    Spring does provide means for accessing and configurating beans. The actual invocation has to be done from your code, so you are responsible for threading and synchronization.

    Maybe you should have a look at the util.concurrent package (in Java 5.0 or as add-on for older JDKs) for useful classes in context of concurrent programming.

    Regards,
    Andreas

    Comment


    • #3
      Check this topic:

      http://forum.springframework.org/sho...ghlight=active

      And you could also realise it yourself. You could create a task to be executed, and drop it in a Executor (java 5). See the ThreadPoolExecutor.

      Comment


      • #4
        I am using JDK 1.4 and cannot switch to 5 now.
        And besides, yes - I know about Thread'ing - but is not that prohibited for use in Web container? I did not mention, but I am using Spring in a WAR.

        Comment


        • #5
          Originally posted by o.p.
          I am using JDK 1.4 and cannot switch to 5 now.
          There is a backport for java 1.4

          And besides, yes - I know about Thread'ing - but is not that prohibited for use in Web container? I did not mention, but I am using Spring in a WAR.
          Nope.. only with EJB.

          Comment


          • #6
            Have you looked at Spring's JMS Support?

            Comment

            Working...
            X