Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

IMultithreadedChannel is a multithreaded version of the IChannel API. Each IChannel-like method is accomanied by a String key representing which virtual "instance" of the channel is being called. This allows a single instance of IMultithreadedChannel to take the place of many IChannel instances.

IChannel vs. IMultithreadedChannel

Advantages of IChannel

A much simpler API. Easier to avoid common mistakes. You can just use instance variables to hold your state for this particular instance of this particular channel, servicing just one box on one user's screen.

Appropriate resource recovery when a user's session ends can "just happen" – the reference to the IChannel from the session ends, so it is garbage-collectible. (Of course, you can and should recover resources sooner via the session done event). A risk in IMultithreadedChannel is reliance upon proper propogation of that event to drop state from internal maps.

More object-oriented. There's an IChannel instance for each box on each user's screen. Easy to get your brain around.

Advantages of IMultithreadedChannel

Less object creation? A single object instance can service multiple threads.

the interface definition

Unknown macro: {code|title=IMultithreadedChannel}

/* Copyright 2001 The JA-SIG Collaborative. All rights reserved.

package org.jasig.portal;

import org.xml.sax.ContentHandler;

/**

  • An interface for multithreaded channels.
  • Multithreaded channels are trusted to keep their own state/session/user
  • separation (instead of relying on the servlet engine to do so).
  • The methods are exact analogs of those in
    Unknown macro: {@link IChannel}

    interface,

    • but means to identify the channel instance are passed along
    • with each method.
    • Please refer to
    interface for method descriptions.
  • @author Peter Kharchenko <a href="mailto:">pkharchenko@interactivebusiness.com</a>
  • @version $Revision: 1.3 $
  • @see IChannel
  • @see IMultithreadedCacheable
    */

public interface IMultithreadedChannel {

/**

  • @param uid a string uniqly identifying a channel "instance" in the system.
  • For example, a combination of session id and channel instance id would fit the bill.
    */
    public void setStaticData (ChannelStaticData sd, String uid) throws PortalException;
    public void setRuntimeData (ChannelRuntimeData rd, String uid) throws PortalException;

public void receiveEvent (PortalEvent ev,String uid);

public ChannelRuntimeProperties getRuntimeProperties (String uid);
public void renderXML (ContentHandler out,String uid) throws PortalException;
}


  • No labels