⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cngptransaction.java

📁 移动CMPP的网关,JAVA又一实现,非常完整的代码.
💻 JAVA
字号:


package com.grail.comm.cngp;

import com.grail.comm.cngp.message.CNGPMessage;
import com.grail.comm.core.PException;
import com.grail.comm.core.PLayer;
import com.grail.comm.core.PMessage;
import com.grail.util.Debug;


/**
 * <p>Title: 短信 项目</p>
 *
 * <p>Description:</p>
 *
 * <p>Copyright: Copyright (c) 2004 合力阳光</p>
 *
 * <p>Company: 合力阳光</p>
 * @author ray/刘有为
 * @version 1.0
 */
public class CNGPTransaction extends PLayer
{

    private CNGPMessage receive;
    private int sequenceId;//消息流水号

    public CNGPTransaction(PLayer connection)
    {
        super(connection);
        sequenceId = id;
    }

    public synchronized void onReceive(PMessage msg)
    {
        receive = (CNGPMessage)msg;
        sequenceId = receive.getSequenceId();
        if(CNGPConstant.debug)
            Debug.dump(receive.toString());
        notifyAll();
    }

    public void send(PMessage message)
        throws PException
    {
        CNGPMessage msg = (CNGPMessage)message;
        msg.setSequenceId(sequenceId);
        parent.send(message);
        if(CNGPConstant.debug)
            Debug.dump(msg.toString());
    }

    public CNGPMessage getResponse()
    {
        return receive;
    }

    public synchronized void waitResponse()
    {
        if(receive == null)
            try
            {
                wait(((CNGPConnection)parent).getTransactionTimeout());
            }
            catch(InterruptedException interruptedexception) { }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -