0 Replies Latest reply on Nov 6, 2008 5:16 AM by Chetan Parekh

    Traversing and filtering of Tree Structured objects and thre

    Chetan Parekh Newbie

      We are catching objects of tree structured class in cache. Following is the signature of class

      Class : MyClass
      An object of MyClass can have any number of children of the same type and children can have any number of their children as well. This can continue upto N level.

      Methods
      public MyClass addChild (MyClass child)
      public Collection getChildren (ArralyList filter)
      This method take ArrayList as an input and return ArrayList of children - baring those which exist in ArrayList filter. Method uses Iterator to traverse through ArrayList during filtration.

      We fetch these objects from cache, traverse through them and read all node values. We are accessing these objects in read-only mode; there will not be any write operation on these objects.

      Problem:
      Total concurrent users of the application are around 20K and multiple thread are going to call getChildren(ArralyList filter). Parameter value for filter will very from user to user. Now suppose first thread calls getChildren (ArrayList filter) method and it reaches half the way. First thread loose the control and second thread get the control and calls getChildren (ArrayList filter) by passing different value for parameter filter.

      Will this operation thread safe?