This page is intended to house documentation of the channel lifecycle. When are channels instantiated? When do they go out of scope? How is this different for different kinds of channels?
Tip | ||
---|---|---|
| ||
There are lots more flavors of channels than basic IChannels. If you understand the lifecycle for another flavor of channel, please add to this page documenting it. Thanks! |
A basic IChannel
First, let's understand the lifecycle for a plain vanilla no-frills IChannel.
An instance of IChannel represents one of the little rectangles in some particular user's layout during some particular session. When a user first renders a tab, each channel in that tab gets instantiated. Those IChannel instances remain in the ChannelManager in the UserInstance in that user's HttpSession until that session times out. Once it times out, the IChannels become avaiable for garbage collection. If the user logs in again, she will get new IChannel instances.
So, the first time a tab is rendered for a particular user for a particular session, we instantiate the IChannel. We then lookup the ChannelStaticData for this channel instance (channel parameters in the database, etc.) and we call the IChannel method setStaticData() with that ChannelStaticData. The typical IChannel will remember this static data as an instance variable.
Then, we call setRuntimeData() to convey runtime data – any parameters on the URL directed at this channel, say.
Finally, we ask the channel to please renderXml().
On subsequent requests, we will first call setRuntimeData(), and then renderXml().
When the user's session ends, we will send the PortalEvent.SESSION_DONE.