Ejemplo n.º 1
0
        private I waitReplyMonitor(ReplyMonitor <O, I> mon)
        {
            if (mon.getReply() == null)
            {
                mon.waitReply(timeout);
            }

            sentCommandsQueue.Remove(mon);

            if (mon.getReply() != null)
            {
                return(mon.getReply());
            }
            throw new IOException(String.Format(Cres.get().getString("cmdTimeout"), mon.getCommand()));
        }
Ejemplo n.º 2
0
        public ReplyMonitor <O, I> sendCommand(O cmd)
        {
            if (!thread.IsAlive)
            {
                lock (sentCommandsQueue)
                {
                    foreach (var cur in sentCommandsQueue)
                    {
                        cur.setReply(null);
                    }
                }

                lock (unsentCommandsQueue)
                {
                    foreach (var cur in unsentCommandsQueue)
                    {
                        cur.setReply(null);
                    }
                }

                throw new DisconnectionException(Cres.get().getString("cmdDisconnected"));
            }

            var mon = new ReplyMonitor <O, I>(cmd);

            if (sendImmediately)
            {
                addSentCommand(mon);
                doSend(cmd);
            }
            else
            {
                unsentCommandsQueue.enqueue(mon);
            }

            return(mon);
        }
Ejemplo n.º 3
0
 protected void addSentCommand(ReplyMonitor <O, I> mon)
 {
     sentCommandsQueue.Add(mon);
 }