(I'm using a version synchronized from CVS last night)
Request #1
----------
I'm trying to use the classes:
org.beepcore.beep.core.event.ChannelListener
org.beepcore.beep.core.event.SessionListener
in order to clean up various things when sessions and channels are
closed, but with the current design, I can't install these listeners
into the Session object until after creation time. This leads to a race
condition and missed events. For instance, suppose I have:
1: Session session = TCPSessionCreator.listen(port, reg);
2: MyEventListener listener = new MyBeepListener(); // implements
both listeners
3: session.addChannelListener(listener);
4: session.addSessionListener(listener);
Between lines 1 and 2, a bunch of stuff can happen to the session that I
won't be able to detect because my listener isn't installed yet.
Can the static method TCPSessionCreator.listen(...) be overloaded again
so that there's a version that looks like:
public static TCPSession listen(int port, ProfileRegistry
registry,
SessionListener sl,
ChannelListener cl)
throws BEEPException;
This way, the listeners can be installed at Session creation time, not
afterwards.
Request #2
----------
The Channel object has a setData(Object) and getData() method so that
applications can store per-channel data with each channel.
Can this be done for the Session object also? This is especially
relevant for the SessionListener object, which receives a Session in the
EventObject. I have per-session data that needs to be changed on
sessionClosed() events, but the only way I can find this data now is if
I use a HashMap (using the default Object.hashCode() method in Session).
Request #3
----------
Additionally, if there are multiple channels open in a session, and the
session is closed (due to a disconnect, for instance), no
ChannelListener.channelClosed() events are generated for the channels
which were opened (but now are closed), nor is the
StartChannelListener.closeChannel() method called (these are probably
redundant, since the indicate the same event). Can this be changed so
that channelClosed events are generated when a session is closed
(perhaps indicating the reason the channel closed in the ChannelEvent
object), and can the redundant methods (ChannelListener.channelClose()
and StartChannelListener.closeChannel()) be cleaned up?
-Michael Fortson
|