Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] ECF ChatClient


Can you shortly outline what the server is (supposed to be) doing and
what the above means?

Sure. The server advertises a ChatServer service which is consumed by the clients. The clients can post messages into this server. This works fine.

The idea (yours actually) is that the clients advertise a Listener (ICatListener) that gets consumed by the server and called upon receiving a new message. This does not work if the Server runs on the same machine as the discovery server. Hence my message stating that we have to run this on a separate server.
 


PS: org.eclipse.ecf.example.chat.model.IChatServer.getMessages(Long)
requires a timestamp. This is kind of fuzzy as the clocks of the nodes
are not synchronized and never can be in a distributed system? Why not
use a simpler message counter at the server that enumerates the chat
messages? Semantically it would change the getMessage's javadoc comment
from "Get the messages since the passed time." to "Get the messages
since message N."

I do exactly that only not with a counter but with the server's time. The reason I did not use a counter is that this frees the server from the implied duty to keep all messages. E.g. if the client gets counter 27 it might expect to get 27 messages. Using this magic time does not imply any result length.
 


PPS:
org.eclipse.ecf.example.chat.server.core.internal.ChatServer.notifyListeners(Long)'s
job seems to turn a List into a Set. It suprisingly also calls
org.eclipse.ecf.example.chat.server.core.internal.ChatServer.doBackGroundNotify(ArrayList<IChatServerListener>,
Long) as part of the for loop.

I move the listeners to a new list to prevent a possible lock when a new listener comes in _during_ listener notification. Note that I have not gotten this to work.

Cheers,

Wim

Back to the top