public MySqlToSqlServer2(bool crnewtable)
        {
            //清楚所有的mysql连接
            CreateNewTable.KillSleepingConnections(0,ref sql_conn_num);

            pagesize = Convert.ToInt16(ConfigurationManager.AppSettings["pagesize"]);

            string mysqlconnstring = ConfigurationManager.ConnectionStrings["guangzhou_0410Entities"].ToString();

            mysqlcontext = new guangzhou_0410Entities(mysqlconnstring);

            mysqlcontext.CommandTimeout = 3600;

            string serverconnstring = ConfigurationManager.ConnectionStrings["GuangZhou_GnEntities"].ToString();

            servercontext = new GuangZhou_GnEntities(serverconnstring);

            serverconn = ConfigurationManager.ConnectionStrings["serverconn"].ToString();

            mysqlconn = mysqlcontext.Connection.ConnectionString;

            sych = new SychronizeCache<ConcurrentBag<mpos_gn_common>>(maxqueuelength);

            if (crnewtable)
                servercontext.ExecuteStoreCommand(CreateNewTable.CreateNewServerTable);
        }
        //清理mysql的连接是个问题?是影响速度的主要原因
        public void produce(object pagenum)
        {
            //CreateNewTable.KillSleepingConnections(0,out sql_conn_num);

            Console.WriteLine("produce:{0}", (int)pagenum * pagesize);

            using (guangzhou_0410Entities mysqlc = new guangzhou_0410Entities(mysqlconn))
            {
                ConcurrentBag<mpos_gn_common> gnbag = new ConcurrentBag<mpos_gn_common>();

                mysqlc.CommandTimeout = 3600;

                var mysqls_split_id = session_list.Skip((int)pagenum * pagesize)
                    .Take(pagesize).Select(e => e.Key).ToArray();

                var mysqls_split_data = mysqlc
                    .gn_common_201204181300
                    .Where(e => mysqls_split_id.Contains(e.Session_ID));

                Parallel.ForEach(mysqls_split_data,
                    (m) => Parallel.Invoke(() =>
                        LoadData(m, ref gnbag)));

                try
                {
                    Task.Factory.StartNew(() => bulkLoadToServer(gnbag));
                }
                catch { }

                mysqlc.Connection.Close();
            }
        }