adapter = _adapter; SimpleTimer.addPeriodicEvent( "TestPingSourceImpl", 1000, new TimerEventPerformer() { private int ticks; public void perform( TimerEvent event ) { ticks++; List sources_to_update; synchronized( sources ){ while( sources.size() < contact_num ){ addContact( new testSource()); } sources_to_update = sources.getList(); } if ( period > 0 ){ if ( ticks % period == 0 ){ testSource[] contacts = new testSource[sources_to_update.size()]; sources_to_update.toArray( contacts ); update( contacts ); } } } });
synchronized( sources ){ sources.add( contact ); } for (int i=0;i<listeners.size();i++){ ((DHTSpeedTesterListener)listeners.get(i)).contactAdded(contact); }
listeners.add( listener );
return( adapter );
return( contact_num );
synchronized( sources ){ sources.remove( contact ); }
listeners.remove( listener );
contact_num = number;
int[] round_trip_times = new int[contacts.length]; updateSources( contacts ); for (int i=0;i<round_trip_times.length;i++){ round_trip_times[i] = contacts[i].getRTT(); } for (int i=0;i<listeners.size();i++){ ((DHTSpeedTesterListener)listeners.get(i)).resultGroup( contacts, round_trip_times ); }