/*
* 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();
}
}
}
}