Exemplo n.º 1
0
 /// <summary>
 /// Tests the communication with the DataProcessingServer.
 /// </summary>
 /// <param name="i">communication parameter.</param>
 /// <returns>2 * commpar - 1 if the DataProcessingServer object and the communication are working properly.</returns>
 public int TestComm(int commpar)
 {
     m_pCommpar        = commpar;
     m_ReturnException = null;
     m_Thread          = new System.Threading.Thread(new System.Threading.ThreadStart(
                                                         delegate()
     {
         try
         {
             m_ReturnObj = m_Srv.TestComm(m_pCommpar);
         }
         catch (Exception x)
         {
             m_ReturnException = x;
         }
     }
                                                         ));
     m_Thread.Start();
     if (m_Thread.Join(m_Timeout) == false)
     {
         try
         {
             m_Thread.Abort();
         }
         catch (Exception) {}
         m_Srv = null;
         throw new Exception("Communication timeout!");
     }
     if (m_ReturnException != null)
     {
         throw m_ReturnException;
     }
     return((int)m_ReturnObj);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Gets the result for a batch.
 /// </summary>
 /// <param name="id">the id of the batch.</param>
 /// <returns>the batch descriptor. It is modified to reflect the batch output. An exception is thrown if the batch terminated with an exception.</returns>
 public DataProcessingBatchDesc Result(ulong id)
 {
     m_ReturnException = null;
     m_pId             = id;
     m_Thread          = new System.Threading.Thread(new System.Threading.ThreadStart(
                                                         delegate()
     {
         try
         {
             m_ReturnObj = m_Srv.Result(m_pId);
         }
         catch (Exception x)
         {
             m_ReturnException = x;
         }
     }
                                                         ));
     m_Thread.Start();
     if (m_Thread.Join(m_Timeout) == false)
     {
         try
         {
             m_Thread.Abort();
         }
         catch (Exception) {}
         m_Srv = null;
         throw new Exception("Communication timeout!");
     }
     if (m_ReturnException != null)
     {
         throw m_ReturnException;
     }
     return((DataProcessingBatchDesc)m_ReturnObj);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Checks for execution completion.
 /// </summary>
 /// <param name="id">the id of the batch.</param>
 /// <returns>true if the batch has been completed, false if it is in progress.</returns>
 public bool DoneWith(ulong id)
 {
     m_ReturnException = null;
     m_pId             = id;
     m_Thread          = new System.Threading.Thread(new System.Threading.ThreadStart(
                                                         delegate()
     {
         try
         {
             m_ReturnObj = m_Srv.DoneWith(m_pId);
         }
         catch (Exception x)
         {
             m_ReturnException = x;
         }
     }
                                                         ));
     m_Thread.Start();
     if (m_Thread.Join(m_Timeout) == false)
     {
         try
         {
             m_Thread.Abort();
         }
         catch (Exception) {}
         m_Srv = null;
         throw new Exception("Communication timeout!");
     }
     if (m_ReturnException != null)
     {
         throw m_ReturnException;
     }
     return((bool)m_ReturnObj);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Enqueues a batch.
 /// </summary>
 /// <param name="desc">the descriptor of the batch.</param>
 /// <returns>true if the batch has been accepted, false otherwise.</returns>
 public bool Enqueue(DataProcessingBatchDesc desc)
 {
     m_ReturnException = null;
     m_pDesc           = desc;
     m_Thread          = new System.Threading.Thread(new System.Threading.ThreadStart(
                                                         delegate()
     {
         try
         {
             m_ReturnObj = m_Srv.Enqueue(m_pDesc);
         }
         catch (Exception x)
         {
             m_ReturnException = x;
         }
     }
                                                         ));
     m_Thread.Start();
     if (m_Thread.Join(m_Timeout) == false)
     {
         try
         {
             m_Thread.Abort();
         }
         catch (Exception) {}
         m_Srv = null;
         throw new Exception("Communication timeout!");
     }
     if (m_ReturnException != null)
     {
         throw m_ReturnException;
     }
     return((bool)m_ReturnObj);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Draws a batch out ouf the queue or aborts it if it is already being executed.
 /// A non-null token or a username/password pair must be supplied that matches the one with which the batch was started.
 /// If the token is supplied, the username/password pair is ignored.
 /// </summary>
 /// <param name="id">identifier of the batch to be removed.</param>
 /// <param name="token">the process token to be used.</param>
 /// <param name="user">username of the user that started the batch. Ignored if <c>token</c> is non-null.</param>
 /// <param name="password">password of the user that started the batch. Ignored if <c>token</c> is non-null.</param>
 public void Remove(ulong id, string token, string user, string password)
 {
     m_pId             = id;
     m_pUser           = user;
     m_pPassword       = password;
     m_ReturnException = null;
     m_Thread          = new System.Threading.Thread(new System.Threading.ThreadStart(
                                                         delegate()
     {
         try
         {
             m_Srv.Remove(m_pId, m_pToken, m_pUser, m_pPassword);
         }
         catch (Exception x)
         {
             m_ReturnException = x;
         }
     }
                                                         ));
     m_Thread.Start();
     if (m_Thread.Join(m_Timeout) == false)
     {
         try
         {
             m_Thread.Abort();
         }
         catch (Exception) {}
         m_Srv = null;
         throw new Exception("Communication timeout!");
     }
     if (m_ReturnException != null)
     {
         throw m_ReturnException;
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Builds a new SyncDataProcessingServerWrapper around a DataProcessingServer.
 /// </summary>
 /// <param name="srv">the DataProcessingServer to be wrapped.</param>
 /// <param name="timeout">the communication timeout to be used.</param>
 public SyncDataProcessingServerWrapper(IDataProcessingServer srv, System.TimeSpan timeout)
 {
     m_Srv     = srv;
     m_Timeout = timeout;
 }