2010年6月4号--SGS-RedDwarf之ClientSession
Interface ClientSession
ClientSession对象代表在客户端与服务器之间的一个单例的、已连接的login session。所有实现了ClientSession的类也必须实现Serializable接口。
当一个客户端进入应用程序之后,应用程序的AppListener.loggedIn方法被调用,并且一个代表着当前客户端与服务器之间的新的ClientSession作为其参数。并且从该方法为每一个作为参数的ClientSession返回一个唯一的ClientSessionListener,应用程序会在客户端即ClientSession发送消息或者断开连接或者logs out登出应用程序时,获得通知。为了明确的断开一个ClientSession连接,会调用DataManager.removeObject方法从data manager中移除和该clientsession先关联的clientsession对象。
英文原文(来自RedDwarf Server 0.10.1 External API):
Interface representing a single, connected login session between a client and the server. Classes that implement ClientSession must also implement Serializable.
When a client logs in, the application's AppListener.loggedIn method is invoked with a new ClientSession instance which represents the current connection between that client and the server. By returning a unique ClientSessionListener from the loggedIn method for each given client session, the application will receive notification when a client session sends a message, is disconnected, or logs out. To explicitly disconnect a ClientSession, remove the associated ClientSession object from the data manager using the DataManager.removeObject method.
Interface DataManager
提供方法来管理实现共享和持久化数据。(提供方法实现共享和持久化数据的实现。)被管理的数据时那些实现了ManagedObject和Serializable接口的对象。每一个被管理的对象都和被它所引用的所有可串行化的(Serializable)和notManaged对象一起被分离开来保存。如果一个ManagedObject对象引用另一个ManagedObject对象,那么它就必须通过一个用createReference方法创建的ManagedReference来实现。如果不这样做,也就是说尝试通过标准的引用而不是ManagedReference保存一个managed的对象的引用,那么将会导致ObjectIOException异常的抛出。
绑定与names的Managed对象以及所有它们直接或间接所引用的Managed对象,都是由DataManaged保存的。并且由应用程序决定那些Managed对象是不在需要的并且何时把它们从ManagedData中移除出去。
英文原文:
Provides facilities for managing access to shared, persistent objects. Managed objects are objects that implement the ManagedObject and Serializable interfaces. Each managed object is stored separately along with all of the serializable, non-managed objects it refers to. If a managed object refers to another managed object, it must do so through an instance of ManagedReference, created by the createReference method. Attempting to store a reference to a managed object using a standard reference rather than an instance of ManagedReference will typically result in an ObjectIOException being thrown when the current transaction commits.
Managed objects that are bound to names, and any managed objects they refer to directly or indirectly, are stored by the DataManager. It is up to the application to determine when managed objects are no longer needed and to remove them explicitly from the DataManager using the removeObject method.
Interface ClientSession
ClientSession对象代表在客户端与服务器之间的一个单例的、已连接的login session。所有实现了ClientSession的类也必须实现Serializable接口。
当一个客户端进入应用程序之后,应用程序的AppListener.loggedIn方法被调用,并且一个代表着当前客户端与服务器之间的新的ClientSession作为其参数。并且从该方法为每一个作为参数的ClientSession返回一个唯一的ClientSessionListener,应用程序会在客户端即ClientSession发送消息或者断开连接或者logs out登出应用程序时,获得通知。为了明确的断开一个ClientSession连接,会调用DataManager.removeObject方法从data manager中移除和该clientsession先关联的clientsession对象。
英文原文(来自RedDwarf Server 0.10.1 External API):
Interface representing a single, connected login session between a client and the server. Classes that implement ClientSession must also implement Serializable.
When a client logs in, the application's AppListener.loggedIn method is invoked with a new ClientSession instance which represents the current connection between that client and the server. By returning a unique ClientSessionListener from the loggedIn method for each given client session, the application will receive notification when a client session sends a message, is disconnected, or logs out. To explicitly disconnect a ClientSession, remove the associated ClientSession object from the data manager using the DataManager.removeObject method.
Interface DataManager
提供方法来管理实现共享和持久化数据。(提供方法实现共享和持久化数据的实现。)被管理的数据时那些实现了ManagedObject和Serializable接口的对象。每一个被管理的对象都和被它所引用的所有可串行化的(Serializable)和notManaged对象一起被分离开来保存。如果一个ManagedObject对象引用另一个ManagedObject对象,那么它就必须通过一个用createReference方法创建的ManagedReference来实现。如果不这样做,也就是说尝试通过标准的引用而不是ManagedReference保存一个managed的对象的引用,那么将会导致ObjectIOException异常的抛出。
绑定与names的Managed对象以及所有它们直接或间接所引用的Managed对象,都是由DataManaged保存的。并且由应用程序决定那些Managed对象是不在需要的并且何时把它们从ManagedData中移除出去。
英文原文:
Provides facilities for managing access to shared, persistent objects. Managed objects are objects that implement the ManagedObject and Serializable interfaces. Each managed object is stored separately along with all of the serializable, non-managed objects it refers to. If a managed object refers to another managed object, it must do so through an instance of ManagedReference, created by the createReference method. Attempting to store a reference to a managed object using a standard reference rather than an instance of ManagedReference will typically result in an ObjectIOException being thrown when the current transaction commits.
Managed objects that are bound to names, and any managed objects they refer to directly or indirectly, are stored by the DataManager. It is up to the application to determine when managed objects are no longer needed and to remove them explicitly from the DataManager using the removeObject method.