Java Reference
In-Depth Information
{
private boolean stop = true;
private int index = 0;
private long interval = 1000;
public Polling()
{
}
public void setInterval( long interval )
{
long temp = this.interval;
this.interval = interval;
AttributeChangeNotification notif = new
AttributeChangeNotification(
this, 0, System.currentTimeMillis(),
"Attribute Change",
"interval", "long", new Long( temp ),
new Long( interval ) );
B
Create
AttributeChange
Notification
sendNotification( notif );
}
public void start()
{
try
{
stop = false;
Thread t = new Thread( this );
t.start();
}
catch( Exception e )
{
e.printStackTrace();
}
}
public void stop()
{
stop = true;
}
public void run()
{
while( !stop )
{
try
{
Thread.sleep( interval );
System.out.println( "Polling" );
}
catch( Exception e )
Search WWH ::




Custom Search