@@ -186,15 +186,8 @@ import Control.Distributed.Process.Internal.Types
186
186
import Control.Distributed.Process.Management.Internal.Agent
187
187
( mxAgentController
188
188
)
189
- import Control.Distributed.Process.Management
190
- ( mxAgent
191
- , mxSink
192
- , liftMX
193
- , mxUpdateLocal
194
- , mxGetLocal
195
- , mxReady
196
- , MxEvent (.. )
197
- , MxAgentId (.. )
189
+ import Control.Distributed.Process.Management.Internal.Types
190
+ ( MxEvent (.. )
198
191
)
199
192
import qualified Control.Distributed.Process.Management.Internal.Trace.Remote as Trace
200
193
( remoteTable
@@ -323,44 +316,6 @@ startDefaultTracer node' = do
323
316
324
317
-- TODO: we need a better mechanism for defining and registering services
325
318
326
- {- note [registry monitoring agent]
327
- This agent listens for 'MxRegistered' and 'MxUnRegistered' events and tracks
328
- all labels for remote 'ProcessId's that are stored in the registry.
329
-
330
- When a remote process is registered, the agent starts monitoring it until it
331
- is unregistered. We can safely ignore ProcessMonitorNotification's, since the
332
- node controller is obligated to issue an MxUnRegistered event for any labels
333
- connected to a dead process. Thus, our only responsibility here is to ensure
334
- that we set up monitors for locally registered processes, and tear them down
335
- once unregistration occurs.
336
- -}
337
-
338
- registryMonitorAgent :: Process ProcessId
339
- registryMonitorAgent = do
340
- nid <- getSelfNode
341
- mxAgent registryMonitorAgentId (Map. empty :: Map String MonitorRef )
342
- [ mxSink $ \ ev -> do
343
- case ev of
344
- MxRegistered pid label
345
- | processNodeId pid /= nid -> do
346
- mref <- liftMX $ monitor pid
347
- mxUpdateLocal (Map. insert label mref)
348
- MxUnRegistered pid label
349
- | processNodeId pid /= nid -> do
350
- mrefs <- mxGetLocal
351
- forM_ (label `Map.lookup` mrefs) $ \ mref -> do
352
- liftMX $ unmonitorAsync mref
353
- mxUpdateLocal (Map. delete label)
354
- _ -> return ()
355
- mxReady
356
- -- [note: no need to remove async answers from mailbox]
357
- -- The framework simply discards any input you don't have a handler for.
358
- -- See Management.hs `runAgent` for details.
359
- ]
360
- where
361
- registryMonitorAgentId :: MxAgentId
362
- registryMonitorAgentId = MxAgentId " service.registry.monitoring"
363
-
364
319
-- | Start and register the service processes on a node
365
320
startServiceProcesses :: LocalNode -> IO ()
366
321
startServiceProcesses node = do
@@ -376,7 +331,6 @@ startServiceProcesses node = do
376
331
-- loops during tracing if the user reregisters the "logger" with a custom
377
332
-- process which uses 'send' or other primitives which are traced.
378
333
register " trace.logger" logger
379
- void $ registryMonitorAgent
380
334
where
381
335
loop = do
382
336
receiveWait
0 commit comments