Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: disconnecting pipes  (Read 3200 times)
emurphy
Jr. Member
**
Posts: 19


View Profile Email
« on: June 04, 2010, 08:33:48 »

So I read the whole thread on disconnecting pipes but still didn't find what I was looking for. Here is what I am currently doing:

:
//remove the pipe
var shellJunction:Junction = QueryMessage(message).getBody() as Junction;

//disconnect the input pipe
var pipeIn:Pipe = junction.retrievePipe(PipeAwareModule.SHELL_IN) as Pipe;
var shellOut:TeeSplit = shellJunction.retrievePipe(PipeAwareModule.STD_OUT) as TeeSplit;
shellOut.disconnectFitting(pipeIn);

So this disconnects the pipe coming out of the shell into the module. I wanted to also disconnect the pipe for traffic out of the module to the shell but the TeeMerge on the shell doesn't have a "disconnectFitting" method. It only has a "disconnect" method. How do I go about disconnecting the module input pipe from the shell without disconnecting all other input pipes to the shell?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: June 04, 2010, 05:06:02 »

I wanted to also disconnect the pipe for traffic out of the module to the shell but the TeeMerge on the shell doesn't have a "disconnectFitting" method.
Just remove the output pipe from the module's Junction (from within the module obviously). This means that before you disconnect the pipe going from the shell to the module, you need to send a message to the module telling it to disconnect its output to the shell first. Then disconnect the shell output to that module and your module is completely disconnected.

This leaves the loose pipe connected to the shell's TeeMerge, but that's no big deal; nothing's going to be sent to it and since it's an input pipe (from the shell's perspective) there's no danger of write errors. The module will no longer have a reference to it and so it can be GC'd (assuming all other references have been cleaned up).

-=Cliff>
Logged
emurphy
Jr. Member
**
Posts: 19


View Profile Email
« Reply #2 on: June 07, 2010, 11:34:08 »

Thanks, that makes sense. I just didn't know if it was OK to leave that pipe hanging there.
-erik
Logged
Pages: [1]
Print