memory file-mapping

Discussions

EJB design: memory file-mapping

  1. memory file-mapping (2 messages)

    As we all know,UNIX and NT both provide technique of file-mapping,which is a file in memory.So different process could share data in file and could communicate block of data through this file.
    I don't know whether Java provide such mechanism independant of platform.I think in same context,we could realize this by creating a singleton class,but how about among different contexts,say, how to share data(lock/unlock) among different application servers(do not use stream-in/stream-out tech,which is not share but communication).

    Threaded Messages (2)

  2. memory file-mapping[ Go to top ]

    As you said Memory-mapped files were inveted as way to achieve interprocess communications. However, Java does not have the concept of process. In Java any class which has a main method can be considered an executable. So when you run a Java program the VM will load the the .class file and all other class files that the program references, explcitly or implicitly. So you have to think about a Java program as a collection of objects running in a VM. If the Java classes are in the same VM you can use a singleton object as a "Memory-mapped" file. But if the Java classes are in different VMs you have to resort to RMI you can still use a singleton class but underneath you have IIOP or or some other wire protocol transfering your data. So the problem is that of Inter VM communication. So two java programs running in two different VM can communicate through the file system and networking but they can't use memory mapped files.
  3. memory file-mapping[ Go to top ]

    thanks. a good documentation.
    Now I have another idea to discuss with you and hope you could check its availability.
    I wonder if we could create a virtual EJB object,which does not map to any real data on disk(flat-file or database).Because EJB object has been controled its synchronization/transaction by container and is transparent among nextwork.Thus we can create a 'global' singleton and can access the 'global' data regardless of VM.
    I don't want to use communication to share data because I think it's expensive and could not control the synchronization.