// create the event object
TempChangedEvent evt = new TempChangedEvent(this, currentTemp);
// make a copy of the listener object vector so that it cannot
// be changed while we are firing events
Vector v;
synchronized(this)
{
v = (Vector) tempChangeListeners.clone();
}
// fire the event to all listeners
int cnt = v.size();
for (int i = 0; i < cnt; i++)
{
TempChangeListener client = (TempChangeListener)v.elementAt(i);
client.tempChanged(evt);
}