• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

struck in coding plz help

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i need to implement a ErrorManager . Which is a singleton class . The client programs would register the listners of the expected Errors .
I am storing all the listners in Vector . If listner for a particular error is registered it wont be added again . Now the problem is that if i have more than one client who register the same listner and one of then removes the listner then the listner gets removed . Is thre any thing that i can do to prevent that . Please suggest me something .
 
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems the dRegister clears the whole vector... Instead clear only the required listener ...

One way to go is, HashMap can be used instead of so that the listener to be cleared can be specified with a key.
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should look at the java.util.Observer interface and the java.util.Observable class. In particular, Observable implements much of the logic you need here. I'm not entirely sure that it will completely solve your problem, but I think it would be worth your time looking into it.

Layne
 
Villains always have antidotes. They're funny that way. Here's an antidote disguised as a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic