/// <summary> /// Creates a new args object for the <see cref="IMessageSinkSource.MessageReceived"/> event. /// </summary> /// <param name="message">The message received.</param> /// <param name="sendMode">The send mode the message was received with.</param> /// <param name="client">The client the message was received from.</param> public static MessageReceivedEventArgs Create(Message message, SendMode sendMode, IClient client) { MessageReceivedEventArgs messageReceivedEventArgs = ServerObjectCache.GetMessageReceivedEventArgs(); messageReceivedEventArgs.message = message; messageReceivedEventArgs.SendMode = sendMode; messageReceivedEventArgs.Client = client; messageReceivedEventArgs.isCurrentlyLoungingInAPool = false; return(messageReceivedEventArgs); }
/// <summary> /// Creates a new args object for the <see cref="IRemoteServer.MessageReceived"/> event. /// </summary> /// <param name="message">The message received.</param> /// <param name="sendMode">The send mode the message was received with.</param> /// <param name="remoteServer">The server the message was received from.</param> public static ServerMessageReceivedEventArgs Create(Message message, SendMode sendMode, IRemoteServer remoteServer) { ServerMessageReceivedEventArgs messageReceivedEventArgs = ServerObjectCache.GetServerMessageReceivedEventArgs(); messageReceivedEventArgs.message = message; messageReceivedEventArgs.SendMode = sendMode; messageReceivedEventArgs.RemoteServer = remoteServer; messageReceivedEventArgs.isCurrentlyLoungingInAPool = false; return(messageReceivedEventArgs); }
/// <summary> /// Initializes the object cache. /// </summary> /// <remarks> /// Normally, initializing the object cache is handled for you when you create a server or client /// however there are times when it is necessary to initialize it without creating a server or client /// such as during testing. This method can be used to initialize the cache in those circumstances. /// /// If the cache is already initialized this method will do nothing. /// /// This method will also initialize the <see cref="ObjectCache"/>. /// </remarks> /// <param name="settings"></param> //DR3 Make static public void InitializeObjectCache(ServerObjectCacheSettings settings) { ObjectCache.Initialize(settings); ServerObjectCache.Initialize(settings); }
/// <summary> /// Recycles this object back into the pool. /// </summary> public void Dispose() { ServerObjectCache.ReturnMessageReceivedEventArgs(this); isCurrentlyLoungingInAPool = true; }