上一篇说了我的均衡算法的思路这里贴出具体代码
接口部分
///日期:2011-09-23
///描述:日志接口
public interface IThreadLog {
public void WriteLog(String msg,boolean addDate) throws Exception;
public void ShowMessage(String msg);
public void ShowAndWriteLog(String msg);
}
///日期:2011-09-23
///描述:均衡类线程对象
public interface IThreadNode extends IThreadNodeBase {
public boolean IsOver();
public void ThreadCallback(Object obj) throws Exception;
public ThreadStatic GetThreadStatic();
public void SetThreadStatic(ThreadStatic threadStatic);
public void SetParameter(IValueItem obj);
public IValueItem GetParameter();
public void Execute();
public boolean IsImmediate();
public IThreadPool Parent();
public void SetParent(IThreadPool parent);
public void Reset();
public void SetErrorCount(int error);
public int GetErrorCount();
}
///日期:2011-09-23
///描述:线程基对象接口
public interface IThreadNodeBase {
public int GetMax();
public int GetCurrent();
public String GetName();
public IThreadLog GetMessage();
public void SetMessage(IThreadLog msg);
public HashMap<String, String> Config();
public void SetConfig(HashMap<String, String> cfg);
}
///日期:2011-09-23
///描述:线程池
public interface IThreadPool extends IThreadNodeBase {
public IThreadNode GetThreadNode(int index);
public IThreadNode GetThreadNode(String name);
public List<IThreadNode> GetThreadNodeCollect();
public void Add(IThreadNode obj);
public boolean IsMax();
public boolean IsBusy();
public void SetParent(ThreadPoolCollect parent);
public void ReturnPool(IThreadNode node);
public void Reset();
public void SetError();
}
///日期:2011-10-08
///描述:执行对象基接口
public interface IValueItem {
public HashMap<String, String> GetConfig();
public void SetConfig(HashMap<String, String> config);
public void Finally() throws Exception;
}