Permalink
Browse files

minor refactoring - removing comments, log-statements, etc

  • Loading branch information...
1 parent da36017 commit 48664fa13f5df86ae08b301c349347505a404724 @amitrathore committed Feb 20, 2010
View
10 src/org/runa/swarmiji/client/client_core.clj
@@ -40,22 +40,15 @@
(attribute-from-response sevak-data :sevak-name))
(defn disconnect-proxy [sevak-proxy]
-; (let [chan (:channel sevak-proxy) queue (:queue sevak-proxy) thread (:thread sevak-proxy)]
(if sevak-proxy
(let [chan (:channel sevak-proxy) queue (:queue sevak-proxy)]
(try
(with-swarmiji-bindings
(.queueDelete chan queue)
(catch Exception e))))))
;no-op, this sevak-proxy should be aborted, thats it
-; (finally
-; (if (.isAlive thread)
-; (do
-; (log-message "Force interrupt!")
-; (.interrupt thread)))))))
(defn on-swarm [sevak-service & args]
- (log-message "On-swarm!")
(let [sevak-start (ref (System/currentTimeMillis))
total-sevak-time (ref nil)
sevak-data (ref swarmiji-sevak-init-value)
@@ -71,7 +64,6 @@
(if (and (swarmiji-diagnostics-mode?) (success?))
(send-work-report (sevak-name) args (sevak-time) (messaging-time) (return-q @sevak-data) (sevak-server-pid @sevak-data)))))
on-swarm-proxy-client (new-proxy (name sevak-service) args on-swarm-response)]
- (log-message "Created sevak proxy:" on-swarm-proxy-client)
(fn [accessor]
(cond
(= accessor :sevak-name) (name sevak-service)
@@ -92,9 +84,7 @@
(defn on-swarm-no-response [sevak-service & args]
- (log-message "On-swarm-no-response!")
(let [on-swarm-proxy-client (new-proxy (name sevak-service) args)]
- (log-message "Created sevak proxy:" on-swarm-proxy-client)
(fn [accessor]
(cond
(= accessor :sevak-name) (name sevak-service)
View
17 src/org/runa/swarmiji/mpi/sevak_proxy.clj
@@ -9,10 +9,6 @@
(use 'org.rathore.amit.utils.clojure)
(use 'org.rathore.amit.utils.config)
(use 'org.rathore.amit.utils.rabbitmq)
-(use 'org.rathore.amit.utils.rabbitmq-multiplex)
-
-;(def STOMP-HEADER (doto (new java.util.HashMap)
-; (.put "auto-delete" true)))
(defn sevak-queue-message-no-return [sevak-service args]
{:sevak-service-name sevak-service
@@ -27,34 +23,25 @@
(with-swarmiji-bindings
(try
(with-open [channel chan]
- ;q-declare args: queue-name, passive, durable, exclusive, autoDelete other-args-map
+ ;q-declare args: queue-name, passive, durable, exclusive, autoDelete other-args-map
(.queueDeclare channel return-q-name); true false false true (new java.util.HashMap))
(let [consumer (QueueingConsumer. channel)]
(.basicConsume channel return-q-name false consumer)
(let [delivery (.nextDelivery consumer)
message (read-clojure-str (String. (.getBody delivery)))]
(custom-handler message)
- (.queueDelete channel return-q-name)
- (log-message "closed channel" return-q-name)))))
+ (.queueDelete channel return-q-name)))))
(catch InterruptedException ie
- (log-message "Encountered forced sevak-termination!")
(log-exception ie))))]
- ;thread (Thread. wait-for-message)]
- (log-message "got new channel:" (.hashCode chan) "now calling wait-for-message")
(send-off (agent :_ignore_) wait-for-message)
- ;(.start thread)
- (log-message "called wait-for-message")
- ;{:channel chan :queue return-q-name :thread thread}))
{:channel chan :queue return-q-name}))
(defn new-proxy
([sevak-service args callback-function]
(let [request-object (sevak-queue-message-for-return sevak-service args)
return-q-name (request-object :return-queue-name)
proxy-object (register-callback return-q-name callback-function)]
- (log-message "registered callback")
(send-message-on-queue (queue-sevak-q-name) request-object)
- (log-message "proxy-object:" proxy-object)
proxy-object))
([sevak-service args]
(let [request-object (sevak-queue-message-no-return sevak-service args)]
View
12 src/org/runa/swarmiji/mpi/transport.clj
@@ -3,10 +3,8 @@
(use 'org.runa.swarmiji.sevak.bindings)
(use 'org.rathore.amit.utils.logger)
(use 'org.rathore.amit.utils.rabbitmq)
-(use 'org.rathore.amit.utils.rabbitmq-multiplex)
(defn send-message-on-queue [q-name q-message-object]
- ;(send-on-transport-amqp (queue-host) (queue-username) (queue-password) q-name (str q-message-object)))
(with-swarmiji-bindings
(with-exception-logging
(send-on-q q-name (str q-message-object)))))
@@ -16,9 +14,11 @@
(defn start-handler-on-queue
([q-name handler-function]
- (with-exception-logging
- (start-queue-message-handler-for-function-amqp (queue-host) (queue-username) (queue-password) q-name handler-function)))
+ (with-swarmiji-bindings
+ (with-exception-logging
+ (start-queue-message-handler-for-function-amqp (queue-host) (queue-username) (queue-password) q-name handler-function))))
([exchange-name exchange-type q-name handler-function]
- (with-exception-logging
- (start-queue-message-handler-for-function-amqp (queue-host) (queue-username) (queue-password) exchange-name exchange-type q-name handler-function))))
+ (with-swarmiji-bindings
+ (with-exception-logging
+ (start-queue-message-handler-for-function-amqp (queue-host) (queue-username) (queue-password) exchange-name exchange-type q-name handler-function)))))
View
1 src/org/runa/swarmiji/sevak/sevak_core.clj
@@ -56,7 +56,6 @@
(with-swarmiji-bindings
(try
(let [req (read-clojure-str req-str)
- _ (log-message "got request" req)
service-name (req :sevak-service-name) service-args (req :sevak-service-args) return-q (req :return-queue-name)
service-handler (@sevaks (keyword service-name))
sevak-agent (agent service-handler)]

0 comments on commit 48664fa

Please sign in to comment.