Announcement Announcement Module
Collapse
No announcement yet.
How to do a Pool of Concurrent Beans Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to do a Pool of Concurrent Beans

    Hi,

    I am not sure about the way I can do this right now, but my main goal is to start 5 threads on a Sybase database to fill 10 database tables with batch data (using BCP Sybase tool).

    So I figure I need a Pool of 5 Thread where 10 Spring Beans (bean.startJob()) will wait to pick their respective thread.

    I know I could do this in plain java, but I guess Spring could give me some good tools to facilitate this job (like using a "prototype" Bean and some "CommonPoolTargetSource?") So... what is the easiest way in Spring to do this job?

    Thanks.

    Etienne.

  • #2
    Re: How to do a Pool of Concurrent Beans

    Originally posted by etienno
    Hi,

    I am not sure about the way I can do this right now, but my main goal is to start 5 threads on a Sybase database to fill 10 database tables with batch data (using BCP Sybase tool).

    So I figure I need a Pool of 5 Thread where 10 Spring Beans (bean.startJob()) will wait to pick their respective thread.

    I know I could do this in plain java, but I guess Spring could give me some good tools to facilitate this job (like using a "prototype" Bean and some "CommonPoolTargetSource?") So... what is the easiest way in Spring to do this job?

    Thanks.

    Etienne.
    You could use the concurrency library from jdk1.5 for the threading part. Create a ThreadPoolExecutorService with 5 threads and you can submit tasks they can execute. See http://forum.springframework.org/viewtopic.php?t=5251 for more information.

    And you can use the Dao support from Spring if you use Hibernate, Ibatis, JDBC. If you use another OR-mapper it shouldn`t be a bigger problem than normal.

    Comment


    • #3
      I cannot use jdk1.5, this would probably help me. I use JDK 1.3.1. Also, I cannot use Hibernate here (any DAO) because I need very fast inserting tool named BCP (CSV File Injection in Sybase Table).

      Any other idea?

      Thanks

      Comment


      • #4
        Originally posted by etienno
        I cannot use jdk1.5, this would probably help me. I use JDK 1.3.1.
        There is a backport so you can use it with 1.4 (maybe it works on 1.3).

        And it isn`t very difficult to write something yourself. And there are enough implementation you can use. You could use the original jsr166 implementation from doug lea (I guess that will work anyway).

        Also, I cannot use Hibernate here (any DAO) because I need very fast inserting tool named BCP (CSV File Injection in Sybase Table).
        You don`t need use dao`s This was only an suggestion.

        Comment


        • #5
          Thanks a lot, I will look this package.

          Comment

          Working...
          X