zeromq - Thread does not progress past ZMQ.context(1) -
I'm trying to implement a simple pub sub instance where there is a server and about the uptime for the client Publishing Periodic Notices
This is being run as part of a Windows service - Insole Setup and Launch 4J and Batch with Apache Process / Proserve.
The thread does not go beyond the creation of the reference. What could be wrong? found a bug; Error creating service installer when creating this installer There was a simple issue to go. The log did not show that the square could not be found. Fixed. import java.io.IOException; Import java.util.Date; Import org.msgpack.MessagePack; Import org.slf4j.Logger; Import org.slf4j.LoggerFactory; Import org.zeromq.zmq; Import org.ocpsoft.prettytime *; / ** * Notification Service * @ Author Aalhad * / Public Category Notification Server Expansion Thread {Private Final Logger Log = Logging for notification of configuration in logger. Tag (this .getClass ()); Private volatile boolean should; Private pretimetime uptime; Personal Preferences Manager prefMgr = PreferenceManager.getInstance (); Public jmq Reference Reference; Public ZMQ.Socket pubSocket; Public Notification Server () {Log. Debug ("Notification Server Constructor .................."); Context = ZMQ.context (1); Log.debug ("It is not printed ... it seems that we are blocking in ZMQ.context !!!"); PubSocket = context.socket (ZMQ.PUB); PubSocket.bind ("TCP: // *:" + prefMgr.getNotificationPort ()); PubSocket.bind ("Indian Penal Code: // powerlogger"); Log.debug ("created notification server"); } @ Override Public Wide Run () {log.debug ("Entering the Run Loop of Notification Server"); SetStarting (); Log.debug ("Writing for TCP Port: {}", prefMgr.getNotificationPort ()); UpTime = new beauty (); ConfigMessage msg = prefMgr.getConfigMessage (); Messagepack msgPack = new messagePack (); Byte [] Sendbats; {Log.debug ("go ahead: {}", msg) try; SendBytes = msgPack.write (msg); PubSocket.send (sendBytes); Log.debug ("Finished sending messages"); } Hold (IOException pre) {log. Terror ("Could not send configuration information first", prior); } // Initially and restart, we send the existing configuration from our // Subscriber String Up Sun; While (shouldrun ()) {log.trace ("Notification in loop"); Upsince = upTime.format (new date (0)); Log.trace ("============================================= ================= Start: {} ", Upsans); ConfigMessage cfgMsg = New ConfigMessage (); CfgMsg.msgType = Message type. UPSIN; CfgMsg.message = upSince; Try writing {// ..... code here to write time in a // messagepack structure and publish it to sleep (5000); Log.trace ("after notification sleep in sleep"); } Grip (Prerupted Pre-Stage) {Log. Terror ("Notification thread is sleeping when sleeping."); }}} Public synchronization zero shutdown () {shouldrun = false; Log.trace ("set villains in search server"); Try {if (pubSocket! = Null) {pubSocket.close (); Context.term (); }} Hold (exception e) {log. Terror ("Interesting situation while trying to close discovery socket while shutting down", e); }} Public synchronized zero set restarting () {shouldrun = true; } Private Synchronized Boolean shouldRun () {Return; }}
Comments
Post a Comment