Hey James,
By no means I'm trying to "steal" you from MINA :) but have you checked
Openfire ( http://www.igniterealtime.org/projects/openfire/index.jsp ).
Openfire is an XMPP (aka Jabber) server built on top of MINA. XMPP is the open
standard for IM.
Regards,
-- Gato
On 5/27/08 10:11 PM, "James Ling" <[EMAIL PROTECTED]> wrote:
Hi folks,We have built our IM server based on MINA.It's excellent!Thanks for
you guys' hard work!I have a question to ask,thanks in advance!
snippet codes as followed:
public class TcpHandler extends IoHandlerAdapter
{
private static final Logger logger =
LoggerFactory.getLogger(TcpHandler.class);
@Inject
private ITaskProcessor taskProcessor;
@Inject
private ISessionManager sessionManager;
@Inject
IHarvestServerContext context;
public void sessionCreated(IoSession session)
{}
public void sessionClosed(IoSession session)
{}
public void sessionIdle(IoSession session, IdleStatus status)
{}
public void exceptionCaught(IoSession session, Throwable cause)
{
session.close();
}
/*
* receive any incoming complete packets
*
* @see
org.apache.mina.common.IoHandler#messageReceived(org.apache.mina.common.IoSession,
* java.lang.Object)
*/
public void messageReceived(IoSession session, Object message)
{
/*question is here,when messages have been received,I want to do our business
logic in two different ways,but I dunno how to profile them to see which one's
performance is better.*/
1 put message into a array,then a multithread business logic
processor keeping getting one from the array to do business logic.Then after
the processing,if there are messages that need to be sent-back or broadcasted
to clients ,add them into another array then still a multithread messages
sender keeping getting one from the array to send it to client.
2 just do business here.Then after the processing,if there are
messages that need to be sent-back or broadcasted to clients ,just send them
}
}
TKS a lot!