You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2015/12/04 16:04:08 UTC
[13/17] storm git commit: do not cache subject as it calls thread
local req context
do not cache subject as it calls thread local req context
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/57240b4f
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/57240b4f
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/57240b4f
Branch: refs/heads/master
Commit: 57240b4f1c1aafce51e9465af9b87b7f41e88dec
Parents: 7029aee
Author: Sanket <sc...@untilservice-lm>
Authored: Mon Nov 30 15:29:26 2015 -0600
Committer: Sanket <sc...@untilservice-lm>
Committed: Mon Nov 30 15:29:26 2015 -0600
----------------------------------------------------------------------
.../src/clj/backtype/storm/daemon/nimbus.clj | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/57240b4f/storm-core/src/clj/backtype/storm/daemon/nimbus.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/daemon/nimbus.clj b/storm-core/src/clj/backtype/storm/daemon/nimbus.clj
index a53ff82..9834f25 100644
--- a/storm-core/src/clj/backtype/storm/daemon/nimbus.clj
+++ b/storm-core/src/clj/backtype/storm/daemon/nimbus.clj
@@ -205,17 +205,15 @@
(defn inbox [nimbus]
(master-inbox (:conf nimbus)))
-(defn- get-subject []
+(defn- get-subject
+ []
(let [req (ReqContext/context)]
(.subject req)))
-(def user-subject
- (get-subject))
-
(defn- read-storm-conf [conf storm-id blob-store]
(clojurify-structure
(Utils/fromCompressedJsonConf
- (.readBlob blob-store (master-stormconf-key storm-id) user-subject))))
+ (.readBlob blob-store (master-stormconf-key storm-id) (get-subject)))))
(declare delay-event)
(declare mk-assignments)
@@ -456,7 +454,7 @@
(iterator-seq key-iter)))
(defn- setup-storm-code [nimbus conf storm-id tmp-jar-location storm-conf topology]
- (let [subject user-subject
+ (let [subject (get-subject)
storm-cluster-state (:storm-cluster-state nimbus)
blob-store (:blob-store nimbus)
jar-key (master-stormjar-key storm-id)
@@ -476,7 +474,7 @@
(defn- read-storm-topology [storm-id blob-store]
(Utils/deserialize
- (.readBlob blob-store (master-stormcode-key storm-id) user-subject) StormTopology))
+ (.readBlob blob-store (master-stormcode-key storm-id) (get-subject)) StormTopology))
(defn get-blob-replication-count
[blob-key nimbus]
@@ -1916,14 +1914,14 @@
(let [session-id (uuid)]
(.put (:blob-uploaders nimbus)
session-id
- (.createBlob (:blob-store nimbus) blob-key blob-meta user-subject))
+ (.createBlob (:blob-store nimbus) blob-key blob-meta (get-subject)))
(log-message "Created blob for " blob-key
" with session id " session-id)
(str session-id)))
(^String beginUpdateBlob [this ^String blob-key]
(let [^AtomicOutputStream os (.updateBlob (:blob-store nimbus)
- blob-key user-subject)]
+ blob-key (get-subject))]
(let [session-id (uuid)]
(.put (:blob-uploaders nimbus) session-id os)
(log-message "Created upload session for " blob-key
@@ -1978,7 +1976,7 @@
(^ReadableBlobMeta getBlobMeta [this ^String blob-key]
(let [^ReadableBlobMeta ret (.getBlobMeta (:blob-store nimbus)
- blob-key user-subject)]
+ blob-key (get-subject))]
ret))
(^void setBlobMeta [this ^String blob-key ^SettableBlobMeta blob-meta]
@@ -1988,7 +1986,7 @@
(^BeginDownloadResult beginBlobDownload [this ^String blob-key]
(let [^InputStreamWithMeta is (.getBlob (:blob-store nimbus)
- blob-key user-subject)]
+ blob-key (get-subject))]
(let [session-id (uuid)
ret (BeginDownloadResult. (.getVersion is) (str session-id))]
(.set_data_size ret (.getFileLength is))