posts - 0,  comments - 5,  trackbacks - 0
if (CountConstants.cArrayStackA  ==   null )
                CountConstants.cArrayStackA 
=   new  CountViewArrayStack(CountConstants.CSTACKLENGH);
            
if (CountConstants.cArrayStackB  ==   null )
                CountConstants.cArrayStackB 
=   new  CountViewArrayStack(CountConstants.CSTACKLENGH);
AcceptEntity aEntity 
=   new  AcceptEntity();
CountManager cManager 
=   new  CountManager();
            
if (CountConstants.CSTACKA)
                cManager.countViewNum(CountConstants.cArrayStackA,aEntity);
            
else   if (CountConstants.CSTACKB)
                cManager.countViewNum(CountConstants.cArrayStackB,aEntity);


public   class  CountManager  {
    
    
public   void  countViewNum(CountViewStack cArrayStack,AcceptEntity acceptEntity)
    
{
        
try
        

            cArrayStack.push(acceptEntity);
            
            
// System.out.println("Stack ["+type+"] working …… ");
        }

        
catch (FullViewStackException e)
        

            
// System.out.println ("Stack [A] is Full!");
             int  i  =   0 ;
            Session session
= null ;
            Object[] saveObj 
=   new  Object[CountConstants.CSTACKLENGH];
            AcceptEntity outEntity 
=   null ;
            
            
if (CountConstants.CSTACKA)
            
{
                CountConstants.CSTACKA 
=   false ;
                CountConstants.CSTACKB 
=   true
            }

            
else
            
{
                CountConstants.CSTACKB 
=   false ;
                CountConstants.CSTACKA 
=   true ;
            }


            
try
            
{
                
while  ( ! cArrayStack.isEmpty())
                
{
                    outEntity 
=  (AcceptEntity)cArrayStack.pop();

                    saveObj[i] 
=  outEntity;
                    i
++ ;
                    outEntity 
=   null ;
                }

                session 
=  MailSessionManager.getMailSession();
                EmailEntityManager.batchSave(saveObj,session);
                
if (session != null ) session.close();
                
// Hibernate.batchSave(saveObj);
                saveObj  =   null ;
                
// System.out.println("Stack [A] pop end!!pop[A]:"+iTempList.length);
                cArrayStack.push(acceptEntity);
            }

            
catch (java.util.EmptyStackException ex)
            
{
                System.out.println(
" Error-->countViewNum() " + ex.getMessage());
            }
finally {
                
if (session != null ) session.close();
            }


        }
catch (Exception ex)
        
{
            ex.printStackTrace();
        }

    }


}
posted on 2007-09-26 09:14 crazy 阅读(167) 评论(0)  编辑  收藏 所属分类: java

只有注册用户登录后才能发表评论。


网站导航: