Question: I have `View` with some components handles. I can change color of label like this.   

`labelHandle.setForeground(Color.Blue);`   

I want to make text of this `label` blinking - the idea is that on the `View` I will have method `blink(Boolean on)` and if I call `blink(true)` the method will start new thread which will be class implementing `Runnable`.   

loop of `run()` will be something like this 

```
run() {
    for(;;) {
        if(finished == true) break;
        Thread.sleep(300);
        //this will do the blinking
        if(finished == true) break; //if durring sleep finish was called => end
        if(change) labelHandle.setForeground(Color.Blue);
        else labelHandle.setForeground(Color.Black);

        change = (change) ? false : true; //switch the condition 
    }
}

```

There will be some important points:   

```
boolean finished - says if the thread is finished, the loop for bliniking 
void fihish() {this.finished = false;} //stops the thread job 
boolean change - switch for the collors, each end of loop switch this value, if its true set one color, if its false sets another => here we have blinking ... 

```

Until here its pretty clear how to do it. The main idea is make thread which will carry about the blinking.   

In view I will call:

```
blink(true);
blink(false);

```

which will stars and stops the thread.   

At one time only one view can be active, so I want have only one thread for blinking, which can be used with more views. The thread will be class implementing `Runnable` and should be `Singleton` to ensure, there will be only one thread. 

Is it good idea to make `Singleton` thread like this? (Good or bad practice)

Answer: 
Just set the `.RequestTimeout` [property](https://msdn.microsoft.com/en-us/library/aa239748(v=vs.60).aspx):

```
With FTP
    .URL = strHostName
    .Protocol = 2
    .UserName = strUserName
    .Password = strPassWord
    .RequestTimeout 5       '<------
    .Execute , "Get " + strRemoteFileName + " " + strLocalFileName

```
You should control this in your `.StillExecuting` loop

This should work I think. It mostly depends on what your `inet` class is: *custom* or *MSINET.OCX reference*. If it's custom you should have declared the `cancel` method.

```
Dim dtStart As Date
dtStart = Now
.Execute , "Get " + strRemoteFileName + " " + strLocalFileName
Do While .StillExecuting

    If DateDiff("s", Now, dtStart) > 5 Then
        ' Cancel after5 seconds
        .Cancel
        .Execute , "CLOSE" ' Close the connection
        MsgBox "Download cancelled after 5 seconds"
    End If

    DoEvents
Loop

```