Tutorials to .com

Tutorials to .com » Jsp » Skills » Application of a simple timer: VarTimer (java)

Application of a simple timer: VarTimer (java)

Print View , by: iSee ,Total views: 28 ,Word Count: 94 ,Date: Sun, 23 Aug 2009 Time: 4:05 PM

package cn.com.softwise.mailplug.service;

import java.util.Timer;
import java.util.TimerTask;

public class VarTimer (
private Timer timer;
private int iFreq;
private boolean bRuning;

public VarTimer () (
timer = null;
bRuning = false;

iFreq = 10;
)

public void start () (
if (! bRuning) (
timer = new Timer ();
timer.schedule (new TimerTask () (
public void run () (
bRuning = false;
timer.cancel ();
)
), IFreq * 60 * 1000);
bRuning = true;
)
)

public boolean getCanSendDo () (
return! bRuning;
)
)


Java skills and code Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.