private void end() { if (_evq != null) { _evq.stop(); } else { System.Environment.Exit(0); } }
static void Main(String[] args) { LBMContext ctx = null; /* Context object: container for UM "instance". */ LBMEventQueue evq = new LBMEventQueue(); /* Initialization: create necessary UM objects. */ try { LBMContextAttributes ctxAttr = new LBMContextAttributes(); ctx = new LBMContext(ctxAttr); } catch(LBMException ex) { System.Console.Error.WriteLine("Error initializing LBM objects: " + ex.Message); System.Environment.Exit(1); } /* Initialize and create receiver and receiver callback */ LBMReceiverCallback myReceiverCallback = new LBMReceiverCallback(onReceive); LBMReceiverAttributes rcv_attr = new LBMReceiverAttributes(); LBMTopic rtopic = new LBMTopic(ctx, "test.topic", rcv_attr); LBMReceiver rcv = new LBMReceiver(ctx, rtopic, myReceiverCallback, evq); /* Initialize and create source */ LBMTopic stopic = new LBMTopic(ctx, "test.topic", new LBMSourceAttributes()); LBMSource src = new LBMSource(ctx, stopic); EQThread evqThread = new EQThread(evq); evqThread.start(); try { System.Threading.Thread.Sleep(1000); } catch (Exception eex) { System.Console.Error.WriteLine("Error System.Threading.Thread.Sleep() exception: " + eex.Message); System.Environment.Exit(1); } src.send(Encoding.ASCII.GetBytes("hello"), 5, LBM.MSG_FLUSH); while (cleanup == 0) { try { System.Threading.Thread.Sleep(1000); } catch (Exception eex) { System.Console.Error.WriteLine("Error System.Threading.Thread.Sleep() exception: " + eex.Message); System.Environment.Exit(1); } } evq.stop(); evqThread.join(); src.close(); rcv.close(); ctx.close(); evq.close(); }
private void onExpiration(object arg) { _evq.stop(); }
static void Main(String[] args) { LBMContext ctx = null; /* Context object: container for UM "instance". */ LBMEventQueue evq = new LBMEventQueue(); /* Initialization: create necessary UM objects. */ try { LBMContextAttributes ctxAttr = new LBMContextAttributes(); ctx = new LBMContext(ctxAttr); } catch (LBMException ex) { System.Console.Error.WriteLine("Error initializing LBM objects: " + ex.Message); System.Environment.Exit(1); } /* Initialize and create receiver and receiver callback */ LBMReceiverCallback myReceiverCallback = new LBMReceiverCallback(onReceive); LBMReceiverAttributes rcv_attr = new LBMReceiverAttributes(); LBMTopic rtopic = new LBMTopic(ctx, "test.topic", rcv_attr); LBMReceiver rcv = new LBMReceiver(ctx, rtopic, myReceiverCallback, evq); /* Initialize and create source */ LBMTopic stopic = new LBMTopic(ctx, "test.topic", new LBMSourceAttributes()); LBMSource src = new LBMSource(ctx, stopic); EQThread evqThread = new EQThread(evq); evqThread.start(); try { System.Threading.Thread.Sleep(1000); } catch (Exception eex) { System.Console.Error.WriteLine("Error System.Threading.Thread.Sleep() exception: " + eex.Message); System.Environment.Exit(1); } src.send(Encoding.ASCII.GetBytes("hello"), 5, LBM.MSG_FLUSH); while (cleanup == 0) { try { System.Threading.Thread.Sleep(1000); } catch (Exception eex) { System.Console.Error.WriteLine("Error System.Threading.Thread.Sleep() exception: " + eex.Message); System.Environment.Exit(1); } } evq.stop(); evqThread.join(); src.close(); rcv.close(); ctx.close(); evq.close(); } /* main */
private void onExpiration(object arg) { _lbmEventQueue.stop(); }