summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2010-08-24 15:01:26 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2010-08-24 15:01:26 +0100
commit7226bab4249be72eec5d346b569a6229d858077a (patch)
tree11026f31e7f7a44d27c5a74d491577f59ef394f6
parentd4c59330b551801a691e8c16a028c4afba29a319 (diff)
downloadrabbitmq-server-7226bab4249be72eec5d346b569a6229d858077a.tar.gz
rabbit_channel migrated to prioritisers
-rw-r--r--src/rabbit_channel.erl21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 138df716..4fcdf4eb 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -41,7 +41,8 @@
-export([emit_stats/1, flush/1]).
-export([init/1, terminate/2, code_change/3, handle_call/3, handle_cast/2,
- handle_info/2, handle_pre_hibernate/1]).
+ handle_info/2, handle_pre_hibernate/1, prioritise_call/3,
+ prioritise_cast/2]).
-record(ch, {state, channel, reader_pid, writer_pid, limiter_pid,
transaction_id, tx_participants, next_tag,
@@ -128,10 +129,10 @@ list() ->
info_keys() -> ?INFO_KEYS.
info(Pid) ->
- gen_server2:pcall(Pid, 9, info, infinity).
+ gen_server2:call(Pid, info, infinity).
info(Pid, Items) ->
- case gen_server2:pcall(Pid, 9, {info, Items}, infinity) of
+ case gen_server2:call(Pid, {info, Items}, infinity) of
{ok, Res} -> Res;
{error, Error} -> throw(Error)
end.
@@ -143,7 +144,7 @@ info_all(Items) ->
rabbit_misc:filter_exit_map(fun (C) -> info(C, Items) end, list()).
emit_stats(Pid) ->
- gen_server2:pcast(Pid, 7, emit_stats).
+ gen_server2:cast(Pid, emit_stats).
flush(Pid) ->
gen_server2:call(Pid, flush).
@@ -177,6 +178,18 @@ init([Channel, ReaderPid, WriterPid, Username, VHost, CollectorPid]) ->
{ok, State, hibernate,
{backoff, ?HIBERNATE_AFTER_MIN, ?HIBERNATE_AFTER_MIN, ?DESIRED_HIBERNATE}}.
+prioritise_call(info, _From, _State) ->
+ 9;
+prioritise_call({info, _Items}, _From, _State) ->
+ 9;
+prioritise_call(_Msg, _From, _State) ->
+ 0.
+
+prioritise_cast(emit_stats, _State) ->
+ 7;
+prioritise_cast(_Msg, _State) ->
+ 0.
+
handle_call(info, _From, State) ->
reply(infos(?INFO_KEYS, State), State);