Re: [Wicket-user] java.util.ConcurrentModificationException with RefreshingView (AGAIN!?!?!!)

2007-07-18 Thread Igor Vaynberg
On 7/18/07, Ballist1c [EMAIL PROTECTED] wrote:


 Yep, I made some adjustments to code, to allow for any number of users to
 join a chatSession, rather then just 2.

 What I am doing is , the vector that I am using is within a particular
 class
 and the Iterators for that vector are actually stored within another
 subclass which is stored within a hashmap within this class.


w o w

I got this working before with Iterators directly declared within the class,
 but now that I have moved the iterators to a hashMap so I can store
 multiple
 iterators to the same Vector, it has gone nuts... with the same error:(

 Anyway, let me know what you think


 obviously whatever this thing is, another thread is modifying it, or you
are doing something elsewhere to modify it.

what you should do is instead of returning an iterator directly first copy
the values into an array list and return an iterator to that. java 101.

-igor



--
 chatRefreshingView = new RefreshingView(chatView, new
 PropertyModel(new PropertyModel(ChatView.this.getJumbuckSession(),
 currentChatSession), chatEntries))
 {
 protected Iterator getItemModels()
 {
 //i like cereal
 chatViewItemsIterator = new
 ModelIteratorAdapter(ChatView.this.getJumbuckSession
 ().getCurrentChatSessionIterator())
 {

 protected IModel model(Object object) {
 return new Model((Serializable) object);
 }
 };
 return chatViewItemsIterator;
 }
 protected void populateItem(Item item)
 {
 ChatViewItem chatViewItem = getItem(chatViewItem);
 item.add(chatViewItem);
 chatViewItem.setMyModels();
 }
 };

 add(chatRefreshingView);
 chatRefreshingView.setOutputMarkupId(true);


 ---
 public void setMyModels() //for chatViewItem.setMyModels() above
 {

 IModel chatViewItemModel = getParent().getModel();
 PropertyModel contentsModel = new PropertyModel(chatViewItemModel,
 contents);

 getAuthorChatImage().setModel(new ImagePathFromIdModel(new
 PropertyModel(chatViewItemModel, authorProfileId)));
 getContents().setModel(contentsModel);
 }


 --

 WicketMessage: Error attaching this container for rendering:
 [MarkupContainer [Component id = chatDisplay, page =
 jumbuck.ffweb.wicket.page.FFWeb, path =
 0:main_tabbed_panel:target_panel:tabbed_panel:target_panel:
 chatDisplay.HotListTargetPanel$1,
 isVisible = true, isVersioned = false]]

 Root cause:

 java.util.ConcurrentModificationException
 at java.util.AbstractList$Itr.checkForComodification(AbstractList.java
 :372)
 at java.util.AbstractList$Itr.next(AbstractList.java:343)
 at
 org.apache.wicket.markup.repeater.util.ModelIteratorAdapter.next(
 ModelIteratorAdapter.java:60)
 at
 org.apache.wicket.markup.repeater.DefaultItemReuseStrategy$1.next(
 DefaultItemReuseStrategy.java:71)
 at
 org.apache.wicket.markup.repeater.RefreshingView.addItems(
 RefreshingView.java:189)
 at
 org.apache.wicket.markup.repeater.RefreshingView.onBeforeRender(
 RefreshingView.java:115)
 at org.apache.wicket.Component.beforeRender(Component.java:846)
 at
 org.apache.wicket.MarkupContainer.onBeforeRenderChildren(
 MarkupContainer.java:1449)
 at org.apache.wicket.Component.beforeRender(Component.java:856)
 at
 org.apache.wicket.MarkupContainer.onBeforeRenderChildren(
 MarkupContainer.java:1449)
 at org.apache.wicket.Component.beforeRender(Component.java:856)
 at
 org.apache.wicket.MarkupContainer.onBeforeRenderChildren(
 MarkupContainer.java:1449)
 at org.apache.wicket.Component.beforeRender(Component.java:856)
 at
 org.apache.wicket.ajax.AjaxRequestTarget.respondComponent(
 AjaxRequestTarget.java:757)
 at
 org.apache.wicket.ajax.AjaxRequestTarget.respondComponents(
 AjaxRequestTarget.java:662)
 at
 org.apache.wicket.ajax.AjaxRequestTarget.respond(AjaxRequestTarget.java
 :520)
 at
 org.apache.wicket.request.AbstractRequestCycleProcessor.respond(
 AbstractRequestCycleProcessor.java:103)
 at
 org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java
 :1037)
 at org.apache.wicket.RequestCycle.step(RequestCycle.java:1107)
 at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1176)
 at org.apache.wicket.RequestCycle.request(RequestCycle.java:499)
 at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java
 :257)
 at
 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java
 :127)
 --
 View this message in context:
 

Re: [Wicket-user] java.util.ConcurrentModificationException with RefreshingView (AGAIN!?!?!!)

2007-07-18 Thread Ballist1c

It IS very possible I am going about this from the completely wrong angle... 

The gist of it is, that a whole bunch of users will be reading all the
entries from the same vector in an asynchronised manner. So what I thought
that each user would require their own Iterator to keep track of their
progress through the Vector ... 

The only actions I performed on the vector is adding to it.  I am thinking,
once the iterator is retrieved from getItemModels() does RefreshingView
store the iterator within itself for the duration that its being displayed?
cause if that is the case, i am thinking i dont even NEED to be storing the
iterator with each user!




igor.vaynberg wrote:
 
 On 7/18/07, Ballist1c [EMAIL PROTECTED] wrote:


 Yep, I made some adjustments to code, to allow for any number of users to
 join a chatSession, rather then just 2.

 What I am doing is , the vector that I am using is within a particular
 class
 and the Iterators for that vector are actually stored within another
 subclass which is stored within a hashmap within this class.
 
 
 w o w
 
 I got this working before with Iterators directly declared within the
 class,
 but now that I have moved the iterators to a hashMap so I can store
 multiple
 iterators to the same Vector, it has gone nuts... with the same error:(

 Anyway, let me know what you think
 
 
  obviously whatever this thing is, another thread is modifying it, or you
 are doing something elsewhere to modify it.
 
 what you should do is instead of returning an iterator directly first copy
 the values into an array list and return an iterator to that. java 101.
 
 -igor
 
 
 
 --
 chatRefreshingView = new RefreshingView(chatView, new
 PropertyModel(new PropertyModel(ChatView.this.getJumbuckSession(),
 currentChatSession), chatEntries))
 {
 protected Iterator getItemModels()
 {
 //i like cereal
 chatViewItemsIterator = new
 ModelIteratorAdapter(ChatView.this.getJumbuckSession
 ().getCurrentChatSessionIterator())
 {

 protected IModel model(Object object) {
 return new Model((Serializable) object);
 }
 };
 return chatViewItemsIterator;
 }
 protected void populateItem(Item item)
 {
 ChatViewItem chatViewItem = getItem(chatViewItem);
 item.add(chatViewItem);
 chatViewItem.setMyModels();
 }
 };

 add(chatRefreshingView);
 chatRefreshingView.setOutputMarkupId(true);


 ---
 public void setMyModels() //for chatViewItem.setMyModels() above
 {

 IModel chatViewItemModel = getParent().getModel();
 PropertyModel contentsModel = new
 PropertyModel(chatViewItemModel,
 contents);

 getAuthorChatImage().setModel(new ImagePathFromIdModel(new
 PropertyModel(chatViewItemModel, authorProfileId)));
 getContents().setModel(contentsModel);
 }


 --

 WicketMessage: Error attaching this container for rendering:
 [MarkupContainer [Component id = chatDisplay, page =
 jumbuck.ffweb.wicket.page.FFWeb, path =
 0:main_tabbed_panel:target_panel:tabbed_panel:target_panel:
 chatDisplay.HotListTargetPanel$1,
 isVisible = true, isVersioned = false]]

 Root cause:

 java.util.ConcurrentModificationException
 at java.util.AbstractList$Itr.checkForComodification(AbstractList.java
 :372)
 at java.util.AbstractList$Itr.next(AbstractList.java:343)
 at
 org.apache.wicket.markup.repeater.util.ModelIteratorAdapter.next(
 ModelIteratorAdapter.java:60)
 at
 org.apache.wicket.markup.repeater.DefaultItemReuseStrategy$1.next(
 DefaultItemReuseStrategy.java:71)
 at
 org.apache.wicket.markup.repeater.RefreshingView.addItems(
 RefreshingView.java:189)
 at
 org.apache.wicket.markup.repeater.RefreshingView.onBeforeRender(
 RefreshingView.java:115)
 at org.apache.wicket.Component.beforeRender(Component.java:846)
 at
 org.apache.wicket.MarkupContainer.onBeforeRenderChildren(
 MarkupContainer.java:1449)
 at org.apache.wicket.Component.beforeRender(Component.java:856)
 at
 org.apache.wicket.MarkupContainer.onBeforeRenderChildren(
 MarkupContainer.java:1449)
 at org.apache.wicket.Component.beforeRender(Component.java:856)
 at
 org.apache.wicket.MarkupContainer.onBeforeRenderChildren(
 MarkupContainer.java:1449)
 at org.apache.wicket.Component.beforeRender(Component.java:856)
 at
 org.apache.wicket.ajax.AjaxRequestTarget.respondComponent(
 AjaxRequestTarget.java:757)
 at
 org.apache.wicket.ajax.AjaxRequestTarget.respondComponents(
 AjaxRequestTarget.java:662)
 at
 

Re: [Wicket-user] java.util.ConcurrentModificationException with RefreshingView (AGAIN!?!?!!)

2007-07-18 Thread Igor Vaynberg
the view doesnt keep the iterator, it just iterates over it once when it
renders. iterators arent meant to be kept, they are throwaway objects.

-igor


On 7/18/07, Ballist1c [EMAIL PROTECTED] wrote:


 It IS very possible I am going about this from the completely wrong
 angle...

 The gist of it is, that a whole bunch of users will be reading all the
 entries from the same vector in an asynchronised manner. So what I thought
 that each user would require their own Iterator to keep track of their
 progress through the Vector ...

 The only actions I performed on the vector is adding to it.  I am
 thinking,
 once the iterator is retrieved from getItemModels() does RefreshingView
 store the iterator within itself for the duration that its being
 displayed?
 cause if that is the case, i am thinking i dont even NEED to be storing
 the
 iterator with each user!




 igor.vaynberg wrote:
 
  On 7/18/07, Ballist1c [EMAIL PROTECTED] wrote:
 
 
  Yep, I made some adjustments to code, to allow for any number of users
 to
  join a chatSession, rather then just 2.
 
  What I am doing is , the vector that I am using is within a particular
  class
  and the Iterators for that vector are actually stored within another
  subclass which is stored within a hashmap within this class.
 
 
  w o w
 
  I got this working before with Iterators directly declared within the
  class,
  but now that I have moved the iterators to a hashMap so I can store
  multiple
  iterators to the same Vector, it has gone nuts... with the same error:(
 
  Anyway, let me know what you think
 
 
   obviously whatever this thing is, another thread is modifying it, or
 you
  are doing something elsewhere to modify it.
 
  what you should do is instead of returning an iterator directly first
 copy
  the values into an array list and return an iterator to that. java 101.
 
  -igor
 
 
 
 
 --
  chatRefreshingView = new RefreshingView(chatView, new
  PropertyModel(new PropertyModel(ChatView.this.getJumbuckSession(),
  currentChatSession), chatEntries))
  {
  protected Iterator getItemModels()
  {
  //i like cereal
  chatViewItemsIterator = new
  ModelIteratorAdapter(ChatView.this.getJumbuckSession
  ().getCurrentChatSessionIterator())
  {
 
  protected IModel model(Object object) {
  return new Model((Serializable) object);
  }
  };
  return chatViewItemsIterator;
  }
  protected void populateItem(Item item)
  {
  ChatViewItem chatViewItem =
 getItem(chatViewItem);
  item.add(chatViewItem);
  chatViewItem.setMyModels();
  }
  };
 
  add(chatRefreshingView);
  chatRefreshingView.setOutputMarkupId(true);
 
 
 
 ---
  public void setMyModels() //for chatViewItem.setMyModels() above
  {
 
  IModel chatViewItemModel = getParent().getModel();
  PropertyModel contentsModel = new
  PropertyModel(chatViewItemModel,
  contents);
 
  getAuthorChatImage().setModel(new ImagePathFromIdModel(new
  PropertyModel(chatViewItemModel, authorProfileId)));
  getContents().setModel(contentsModel);
  }
 
 
 
 --
 
  WicketMessage: Error attaching this container for rendering:
  [MarkupContainer [Component id = chatDisplay, page =
  jumbuck.ffweb.wicket.page.FFWeb, path =
  0:main_tabbed_panel:target_panel:tabbed_panel:target_panel:
  chatDisplay.HotListTargetPanel$1,
  isVisible = true, isVersioned = false]]
 
  Root cause:
 
  java.util.ConcurrentModificationException
  at java.util.AbstractList$Itr.checkForComodification(AbstractList.java
  :372)
  at java.util.AbstractList$Itr.next(AbstractList.java:343)
  at
  org.apache.wicket.markup.repeater.util.ModelIteratorAdapter.next(
  ModelIteratorAdapter.java:60)
  at
  org.apache.wicket.markup.repeater.DefaultItemReuseStrategy$1.next(
  DefaultItemReuseStrategy.java:71)
  at
  org.apache.wicket.markup.repeater.RefreshingView.addItems(
  RefreshingView.java:189)
  at
  org.apache.wicket.markup.repeater.RefreshingView.onBeforeRender(
  RefreshingView.java:115)
  at org.apache.wicket.Component.beforeRender(Component.java:846)
  at
  org.apache.wicket.MarkupContainer.onBeforeRenderChildren(
  MarkupContainer.java:1449)
  at org.apache.wicket.Component.beforeRender(Component.java:856)
  at
  org.apache.wicket.MarkupContainer.onBeforeRenderChildren(
  MarkupContainer.java:1449)
  at org.apache.wicket.Component.beforeRender(Component.java:856)
  at
  org.apache.wicket.MarkupContainer.onBeforeRenderChildren(
  

Re: [Wicket-user] java.util.ConcurrentModificationException with RefreshingView (AGAIN!?!?!!)

2007-07-18 Thread Ballist1c

got it I definately was trying to extend there scope for something they can't
be used for :), 

my goal is to get the users to only render what they have to in the vector. 
I do not want them to have to re-render the entire Vector each time. The
vector will be constantly added too, there are no modifications to existing
data however. having the user re-render the entire vector becomes
impractical.  

I have done some reading on nabble and I require the page to display the
current items without having to re-render them, and rendering new Vector
items as they become available.  From what I can see, the solution to this
lies in javascript DOMs... *sigh*... im allergic to javascript :)  

Thanks for your assistance again igor.



igor.vaynberg wrote:
 
 the view doesnt keep the iterator, it just iterates over it once when it
 renders. iterators arent meant to be kept, they are throwaway objects.
 
 -igor
 
 
 On 7/18/07, Ballist1c [EMAIL PROTECTED] wrote:


 It IS very possible I am going about this from the completely wrong
 angle...

 The gist of it is, that a whole bunch of users will be reading all the
 entries from the same vector in an asynchronised manner. So what I
 thought
 that each user would require their own Iterator to keep track of their
 progress through the Vector ...

 The only actions I performed on the vector is adding to it.  I am
 thinking,
 once the iterator is retrieved from getItemModels() does RefreshingView
 store the iterator within itself for the duration that its being
 displayed?
 cause if that is the case, i am thinking i dont even NEED to be storing
 the
 iterator with each user!




 igor.vaynberg wrote:
 
  On 7/18/07, Ballist1c [EMAIL PROTECTED] wrote:
 
 
  Yep, I made some adjustments to code, to allow for any number of users
 to
  join a chatSession, rather then just 2.
 
  What I am doing is , the vector that I am using is within a particular
  class
  and the Iterators for that vector are actually stored within another
  subclass which is stored within a hashmap within this class.
 
 
  w o w
 
  I got this working before with Iterators directly declared within the
  class,
  but now that I have moved the iterators to a hashMap so I can store
  multiple
  iterators to the same Vector, it has gone nuts... with the same
 error:(
 
  Anyway, let me know what you think
 
 
   obviously whatever this thing is, another thread is modifying it, or
 you
  are doing something elsewhere to modify it.
 
  what you should do is instead of returning an iterator directly first
 copy
  the values into an array list and return an iterator to that. java 101.
 
  -igor
 
 
 
 
 --
  chatRefreshingView = new RefreshingView(chatView, new
  PropertyModel(new PropertyModel(ChatView.this.getJumbuckSession(),
  currentChatSession), chatEntries))
  {
  protected Iterator getItemModels()
  {
  //i like cereal
  chatViewItemsIterator = new
  ModelIteratorAdapter(ChatView.this.getJumbuckSession
  ().getCurrentChatSessionIterator())
  {
 
  protected IModel model(Object object) {
  return new Model((Serializable) object);
  }
  };
  return chatViewItemsIterator;
  }
  protected void populateItem(Item item)
  {
  ChatViewItem chatViewItem =
 getItem(chatViewItem);
  item.add(chatViewItem);
  chatViewItem.setMyModels();
  }
  };
 
  add(chatRefreshingView);
  chatRefreshingView.setOutputMarkupId(true);
 
 
 
 ---
  public void setMyModels() //for chatViewItem.setMyModels() above
  {
 
  IModel chatViewItemModel = getParent().getModel();
  PropertyModel contentsModel = new
  PropertyModel(chatViewItemModel,
  contents);
 
  getAuthorChatImage().setModel(new ImagePathFromIdModel(new
  PropertyModel(chatViewItemModel, authorProfileId)));
  getContents().setModel(contentsModel);
  }
 
 
 
 --
 
  WicketMessage: Error attaching this container for rendering:
  [MarkupContainer [Component id = chatDisplay, page =
  jumbuck.ffweb.wicket.page.FFWeb, path =
  0:main_tabbed_panel:target_panel:tabbed_panel:target_panel:
  chatDisplay.HotListTargetPanel$1,
  isVisible = true, isVersioned = false]]
 
  Root cause:
 
  java.util.ConcurrentModificationException
  at java.util.AbstractList$Itr.checkForComodification(AbstractList.java
  :372)
  at java.util.AbstractList$Itr.next(AbstractList.java:343)
  at
  org.apache.wicket.markup.repeater.util.ModelIteratorAdapter.next(