首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

模似CLE多线程处理二

2012-09-08 
模似CLE多线程处理2package com.huawei.esb.clepublic class SetCLEEntity extends Thread{// 每次取500p

模似CLE多线程处理2
package com.huawei.esb.cle;

public class SetCLEEntity extends Thread
{
    // 每次取500
    private int dafultIndex = 10;

    // 每5秒种取一次
    private int dafultTime = 5;

    // 要设置值的对象

    public void run()
    {
        boolean isRuning = true;
        while (isRuning)
        {
            synchronized (TestCle.listAll)
            {
                if (!TestCle.listAll.isEmpty())
                {
                    if (TestCle.listAll.size() > 10)
                    {

                        for (int i = 1; i <= dafultIndex; i++)
                        {
                            CleEntity entity = TestCle.listAll.get(i - 1);
                            Cache.tasks.add(entity);
                            TestCle.listAll.remove(i - 1);
                        }
                    }
                    else
                    {
                        for (int i = 1; i <= TestCle.listAll.size(); i++)
                        {
                            CleEntity entity = TestCle.listAll.get(i - 1);
                            Cache.tasks.add(entity);
                            TestCle.listAll.remove(i - 1);
                        }
                    }
                }
            }
        }
    }
}

热点排行