Which methods should be thread safe?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Which methods should be thread safe?

  1. #1
    J Alder Guest

    Which methods should be thread safe?


    I am creating a data file with methods

    insertRecord

    updateRecord

    deleteRecord

    findRecords

    getSize

    Which methods need to be syncronized? Any input would be appreciated..

  2. #2
    Ako Guest

    Re: Which methods should be thread safe?


    It depends on the degree of concurrency and lock granularity that you want
    to implement. Any method that updates a resource in a way that may cause
    a conflict it should be synchronized.


    updateRecord and deleteRecord will have to be synchronized in all cases.

    Good Luck,

    Ako



    "J Alder" <jAdler@feverton.gov> wrote:
    >
    >I am creating a data file with methods
    >
    >insertRecord
    >
    >updateRecord
    >
    >deleteRecord
    >
    >findRecords
    >
    >getSize
    >
    >Which methods need to be syncronized? Any input would be appreciated..



  3. #3
    J Alder Guest

    Re: Which methods should be thread safe?


    Thanks for the response AKO.. I'll do it!
    "Ako" <ays73@hotmail.com> wrote:
    >
    >It depends on the degree of concurrency and lock granularity that you want
    >to implement. Any method that updates a resource in a way that may cause
    >a conflict it should be synchronized.
    >
    >
    >updateRecord and deleteRecord will have to be synchronized in all cases.
    >
    >Good Luck,
    >
    >Ako
    >
    >
    >
    >"J Alder" <jAdler@feverton.gov> wrote:
    >>
    >>I am creating a data file with methods
    >>
    >>insertRecord
    >>
    >>updateRecord
    >>
    >>deleteRecord
    >>
    >>findRecords
    >>
    >>getSize
    >>
    >>Which methods need to be syncronized? Any input would be appreciated..

    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center