Package TCM_MPIv2.SenderClasses

Source Code of TCM_MPIv2.SenderClasses.SendDatav2_JvmTcp

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package TCM_MPIv2.SenderClasses;

import TCM_MPI_UTILS.Message.Interfaces.InterfaceTcmMpiBasicPackage;
import TCM_MPI_UTILS.Socket.Interfaces.ISocketTcm;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.TimeUnit;

/**
*
* @author dev
*/
public class SendDatav2_JvmTcp implements Runnable{

    private ISocketTcm _ISOCKET;
    private ArrayBlockingQueue<InterfaceTcmMpiBasicPackage> _QUEUE;
   
    private InterfaceTcmMpiBasicPackage _last_poll;
   
    public SendDatav2_JvmTcp(ISocketTcm SOCKET,ArrayBlockingQueue<InterfaceTcmMpiBasicPackage> QUEUE){
        this._ISOCKET = SOCKET;
        this._QUEUE = QUEUE;
    }
   
    @Override
    public void run() {
        while(this._ISOCKET != null){
            try{
                InterfaceTcmMpiBasicPackage pkg = this._QUEUE.poll(1, TimeUnit.SECONDS);
                if(pkg != null){
                    this._ISOCKET.SendMpiPackage(pkg);
                }
            }catch(Exception ex){
                ex.printStackTrace();
            }
        }
    }
   
}
TOP

Related Classes of TCM_MPIv2.SenderClasses.SendDatav2_JvmTcp

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.