Package: com.multiversesocial.hyperview
Class: com.multiversesocial.hyperview.InterProcessMemory
Source: src/com/multiversesocial/hyperview/InterProcessMemory.java
This class is a "simple" implementation of interprocess shared memory. By Tony Swain Jan 13 2013 416478
public class InterProcessMemory extends Linkable implements InterProcessMemoryConstants, Runnable, MemoryInitializer
| Declaration | Value / initializer | Description | Source |
|---|---|---|---|
volatile HyperLinkedList fieldList | A List to map in Field Types that comprise the memory block | ||
volatile RandomAccessFile file | No comment in source; assigned in purge(). | ||
volatile FileChannel fileChannel | No comment in source; assigned in purge(); used in seek(), lockRegion(), lock(), blockingLock(), saveToDevice() …. | ||
volatile String fileName | No comment in source; assigned in InterProcessMemory(); used in purge(). | ||
static volatile int fp0 | Yeh ole 32 bit file pointer. | ||
static volatile long fp1 | No comment in source; not referenced by name in this type’s methods. | ||
Graphics graphics | No comment in source; not referenced by name in this type’s methods. | ||
static volatile int indeces | = 0 | No comment in source; not referenced by name in this type’s methods. | |
volatile int index | in memory list. | ||
InterProcessMemory innerParent | So inner classes can make direct refererences | ||
volatile HyperLinkedList listenerList | No comment in source; assigned in InterProcessMemory(); used in run(), listenerWait(), purge(). | ||
public volatile Thread listenerThread | No comment in source; assigned in start(), stop(), run(); used in lockRegion(), lock(), saveToDevice(). | ||
MappedByteBuffer mappedByteBuffer | A memory mapped Byte Buffer. | ||
volatile int memFlags | No comment in source; assigned in setDataAligned(), setDataUnAligned(), setBitWidth(), lock(), start() …; used in readInt(), writeInt(), readShort(), writeShort(), getBitWidth() …. | ||
String memName | No comment in source; assigned in InterProcessMemory(); used in erase(), exists(). | ||
MemoryInitializer memoryInitializer | No comment in source; assigned in setMemoryInitializer(). | ||
static volatile HyperLinkedList memoryList | No comment in source; used in addListener(), removeListener(); name appears in 1 other source file(s): ViewMemory. | ||
int memoryMode | Allows 32-64 bit reference switch | ||
InterProcessMemory.MemorySaveTimer memoryTimer | No comment in source; assigned in enableBackupTimer(); used in disableBackupTimer(), setUpdateMillis(). | ||
int memoryType | No comment in source; not referenced by name in this type’s methods. | ||
volatile int memSize | No comment in source; assigned in InterProcessMemory(); used in seek(), readInt(), writeInt(), readShort(), writeShort() …. | ||
volatile long memSizeLong | No comment in source; not referenced by name in this type’s methods. | ||
static int processIndex | = 0 | No comment in source; not referenced by name in this type’s methods. | |
int processNumber | No comment in source; not referenced by name in this type’s methods. | ||
long startTime | No comment in source; name appears in 15 other source file(s): Asteroids, CollisionManager, HyperChannel, HyperConnectionHandler …. | ||
static int totalProcesses | = 0 | No comment in source; name appears in 1 other source file(s): HyperProcess. | |
volatile long updateMillis | No comment in source; assigned in InterProcessMemory(), enableBackupTimer(), setUpdateMillis(). |
| Signature | Description | Source |
|---|---|---|
InterProcessMemory() | 1 statement(s); calls this(). | |
InterProcessMemory(int tSize) | 6 statement(s); calls super(); creates HyperLinkedList. | |
InterProcessMemory(String tName, int tSize) | 7 statement(s); calls super(); creates HyperLinkedList. | |
InterProcessMemory(long tUpdateMillis, int tSize) | 2 statement(s); calls this(). |
| Signature | Description | Source |
|---|---|---|
static { … } | Implicit default constructor generated by the compiler (not written in the source). | |
public void addListener(SharedMemoryListener tSharedMemoryListener) | 1 statement(s); calls memoryList.dlStore(), memoryList.notifyAll(). | |
public void appendFieldList(HyperLinkedList tList) | 1 statement(s); calls fieldList.dlStore(), notifyAll(). | |
public FileLock blockingLock(int tStart, int tLength) | 6 statement(s); calls fileChannel.lock(), flie.toString(), olfle.toString(), nwce.toString(), cce.toString() …. | |
int close() | 5 statement(s); calls tList.dlDelete(), tList.notifyAll(), tMemory.fileChannel.close(). | |
static int close(String tName) | 5 statement(s); calls tMemory.memName.equals(), tList.dlDelete(), tMemory.fileChannel.close(), tList.notifyAll(). | |
public void disableBackupTimer(int tMillies) | 2 statement(s); calls memoryTimer.stop(). | |
public void enableBackupTimer(int tMillies) | 4 statement(s); calls memoryTimer.start(); creates MemorySaveTimer. | |
public void erase() | Zero the mapped region and force to device. | |
public boolean exists() | 3 statement(s); calls tFile.exists(); creates File. | |
public byte getBitWidth() | 6 statement(s). | |
public void isLoaded() | 1 statement(s); calls mappedByteBuffer.isLoaded(). | |
public boolean isResident() | Returns ((memFlags & MEM_RESIDENT) == 0 ? false : true). | |
public void listenerWait() | 1 statement(s); calls listenerList.notifyAll(), listenerList.wait(). | |
public void load() | Load Memory from backing file | |
public static void loadMemoryList() | update the all memory from the device. | |
public FileLock lock() | 6 statement(s); calls fileChannel.lock(), flie.toString(), olfle.toString(), nwce.toString(), cce.toString() …. | |
public FileLock lock(int tFlags) | 8 statement(s); calls fileChannel.lock(), flie.toString(), olfle.toString(), nwce.toString(), cce.toString() …. | |
public FileLock lock(int tFlags, int tStart, int tLength) | 8 statement(s); calls fileChannel.lock(), flie.toString(), olfle.toString(), nwce.toString(), cce.toString() …. | |
public FileLock lockRegion(long tPosition, long tSize) | 5 statement(s); calls fileChannel.lock(), flie.toString(), olfle.toString(), nwce.toString(), cce.toString() …. | |
public static void main(String[] argv) throws Exception | 16 statement(s); calls ProcessID.getProcessString(), InterProcessMemory.open(), tInterProcessMemory.setResident(), tInterProcessMemory.readInt(), tInterProcessMemory.writeInt() …; creates Object. | |
static int notifyListeners() | Returns 1. | |
static InterProcessMemory open(InterProcessMemory tInterProcessMemory) throws IllegalAccessException | 9 statement(s); calls tInterProcessMemory.exists(), tMemory.memName.equals(), tInterProcessMemory.file.getChannel(), tInterProcessMemory.fileChannel.map(), any.printStackTrace() …; creates HyperLinkedList, IllegalAccessException, RandomAccessFile. | |
static InterProcessMemory open(String tName) | Returns InterProcessMemory.open(tName, (MemoryInitializer)null). | |
static InterProcessMemory open(String tName, MemoryInitializer tMemoryInitializer) | 6 statement(s); calls tMemory.memName.equals(), tList.notifyAll(), tMemory.file.getChannel(), tMemory.fileChannel.map(), any.printStackTrace() …; creates HyperLinkedList, InterProcessMemory, RandomAccessFile. | |
static InterProcessMemory open(String tName, int tSize) | Returns InterProcessMemory.open(tName, tSize, (MemoryInitializer)null). | |
static InterProcessMemory open(String tName, int tSize, MemoryInitializer tMemoryInitializer) | 8 statement(s); calls tMemory.memName.equals(), tList.notifyAll(), tFile.exists(), tMemory.file.getChannel(), tMemory.fileChannel.map() …; creates HyperLinkedList, InterProcessMemory, File. | |
public void purge() | If the Memory is not resident then delete it from the system. | |
public byte read() throws IllegalMemoryAccessException | 10 statement(s); calls lock(), mappedByteBuffer.position(), mappedByteBuffer.get(), tLock.release(), ioex.printStackTrace(); creates IllegalMemoryAccessException. | |
public int read(int[] tInt, int tOffset) throws IllegalMemoryAccessException | 13 statement(s); calls fileChannel.lock(), mappedByteBuffer.position(), mappedByteBuffer.getInt(), tLock.release(), ioex.printStackTrace(); creates IllegalMemoryAccessException. | |
public int read(byte[] tByte, int tOffset, int tLength) throws IllegalMemoryAccessException | 11 statement(s); calls lock(), mappedByteBuffer.position(), mappedByteBuffer.get(), tLock.release(), ioex.printStackTrace(); creates IllegalMemoryAccessException. | |
public byte readDirect() throws IllegalMemoryAccessException | 8 statement(s); calls mappedByteBuffer.position(), mappedByteBuffer.get(); creates IllegalMemoryAccessException. | |
public int readDirect(int[] tInt, int tOffset) throws IllegalMemoryAccessException | 10 statement(s); calls mappedByteBuffer.position(), mappedByteBuffer.getInt(); creates IllegalMemoryAccessException. | |
public int readDirect(byte[] tByte, int tOffset, int tLength) throws IllegalMemoryAccessException | 8 statement(s); calls mappedByteBuffer.position(), mappedByteBuffer.get(); creates IllegalMemoryAccessException. | |
public int readInt() throws IllegalMemoryAccessException | 12 statement(s); calls lock(), mappedByteBuffer.getInt(), tLock.release(), ioex.printStackTrace(); creates IllegalMemoryAccessException. | |
public int readInt(int tOffset) throws IllegalMemoryAccessException | 12 statement(s); calls lock(), mappedByteBuffer.getInt(), tLock.release(), ioex.printStackTrace(); creates IllegalMemoryAccessException. | |
public int readInt(int tOffset, int[] tInInt) throws IllegalMemoryAccessException | 13 statement(s); calls lock(), mappedByteBuffer.position(), mappedByteBuffer.getInt(), tLock.release(), ioex.printStackTrace(); creates IllegalMemoryAccessException. | |
public int readIntDirect(int tOffset) throws IllegalMemoryAccessException | 9 statement(s); calls mappedByteBuffer.getInt(); creates IllegalMemoryAccessException. | |
public short readShort() throws IllegalMemoryAccessException | 13 statement(s); calls lock(), mappedByteBuffer.position(), mappedByteBuffer.getShort(), tLock.release(), ioex.printStackTrace(); creates IllegalMemoryAccessException. | |
public short readShort(int tOffset) throws IllegalMemoryAccessException | 13 statement(s); calls lock(), mappedByteBuffer.position(), mappedByteBuffer.getShort(), tLock.release(), ioex.printStackTrace(); creates IllegalMemoryAccessException. | |
public void remakeFieldList(HyperLinkedList tList) | 1 statement(s); calls fieldList.drain(), fieldList.dlStore(), notifyAll(). | |
public void removeListener(SharedMemoryListener tSharedMemoryListener) | 1 statement(s); calls memoryList.dlDelete(), memoryList.notifyAll(). | |
public void run() | 5 statement(s); calls Thread.currentThread(), lock(), tMemoryFieldLink.onMemoryChange(), listenerList.notifyAll(), tLock.release() …. | |
public int saveToDevice() | Copy memory to device | |
public int seek(int tInt) throws IllegalMemoryAccessException | 6 statement(s); calls lock(), fileChannel.position(), tLock.release(), ioex.printStackTrace(); creates IllegalMemoryAccessException. | |
public void setBitWidth(byte tBitWidth) throws IllegalMemoryAccessException | 1 statement(s); creates IllegalMemoryAccessException. | |
public void setDataAligned() | Set the data to be aligned to the device memory type | |
public void setDataUnAligned() | 1 statement(s). | |
public void setFieldList(HyperLinkedList tList) | 1 statement(s). | |
public void setMemoryInitializer(MemoryInitializer tMemoryInitializer) | Sets memoryInitializer = tMemoryInitializer. | |
public void setResident() | 1 statement(s). | |
void setUpdateMillis(long tUpdateMillis) | 5 statement(s); calls tThread.interrupt(), memoryTimer.start(). | |
public void start() | 5 statement(s); calls tThread.interrupt(), listenerThread.start(); creates Thread. | |
public void stop() | 3 statement(s); calls tThread.interrupt(). | |
public String toString() | 7 statement(s); calls mappedByteBuffer.limit(), mappedByteBuffer.get(), tStringBuilder.append(), tStringBuilder.toString(); creates StringBuilder. | |
public void unsetResident() | 1 statement(s). | |
public int write(byte tByte) throws IllegalMemoryAccessException | 9 statement(s); calls lock(), mappedByteBuffer.put(), tLock.release(), ioex.printStackTrace(); creates IllegalMemoryAccessException. | |
public int write(byte[] tByte) throws IllegalMemoryAccessException | 9 statement(s); calls lock(), mappedByteBuffer.put(), tLock.release(), ioex.printStackTrace(); creates IllegalMemoryAccessException. | |
public int write(String tString) throws IllegalMemoryAccessException | 13 statement(s); calls tString.length(), lock(), mappedByteBuffer.position(), mappedByteBuffer.put(), tString.getBytes() …; creates IllegalMemoryAccessException. | |
public int write(byte[] tByte, int tOffset, int tLength) throws IllegalMemoryAccessException | 9 statement(s); calls lock(), mappedByteBuffer.position(), mappedByteBuffer.put(), tLock.release(), ioex.printStackTrace(); creates IllegalMemoryAccessException. | |
public int write(String tString, int tOffset, int tLength) throws IllegalMemoryAccessException | 10 statement(s); calls lock(), tString.length(), mappedByteBuffer.position(), mappedByteBuffer.put(), tString.getBytes() …; creates IllegalMemoryAccessException. | |
public int writeDirect(byte tByte) throws IllegalMemoryAccessException | 6 statement(s); calls mappedByteBuffer.put(); creates IllegalMemoryAccessException. | |
public int writeDirect(byte[] tByte) throws IllegalMemoryAccessException | 6 statement(s); calls mappedByteBuffer.put(); creates IllegalMemoryAccessException. | |
public int writeDirect(String tString) throws IllegalMemoryAccessException | 11 statement(s); calls tString.length(), mappedByteBuffer.position(), mappedByteBuffer.put(), tString.getBytes(); creates IllegalMemoryAccessException. | |
public int writeDirect(byte[] tByte, int tOffset, int tLength) throws IllegalMemoryAccessException | 6 statement(s); calls mappedByteBuffer.position(), mappedByteBuffer.put(); creates IllegalMemoryAccessException. | |
public int writeDirect(String tString, int tOffset, int tLength) throws IllegalMemoryAccessException | 8 statement(s); calls tString.length(), mappedByteBuffer.position(), mappedByteBuffer.put(), tString.getBytes(); creates IllegalMemoryAccessException. | |
public int writeInt(int tInt) throws IllegalMemoryAccessException | 11 statement(s); calls lock(), mappedByteBuffer.putInt(), tLock.release(), ioex.printStackTrace(); creates IllegalMemoryAccessException. | |
public int writeInt(int tOffset, int tInt) throws IllegalMemoryAccessException | 10 statement(s); calls lock(), System.exit(), mappedByteBuffer.putInt(), tLock.release(), ioex.printStackTrace(); creates IllegalMemoryAccessException. | |
public int writeInt(int tOffset, int[] tInt) throws IllegalMemoryAccessException | 12 statement(s); calls lock(), System.exit(), mappedByteBuffer.putInt(), tLock.release(), ioex.printStackTrace(); creates IllegalMemoryAccessException. | |
public int writeIntDirect(int tInt) throws IllegalMemoryAccessException | 8 statement(s); calls mappedByteBuffer.putInt(); creates IllegalMemoryAccessException. | |
public int writeIntDirect(int tOffset, int tInt) throws IllegalMemoryAccessException | 7 statement(s); calls mappedByteBuffer.putInt(); creates IllegalMemoryAccessException. | |
int writeRegion(byte[] tByte, int tOffset, int tLength) throws IllegalMemoryAccessException | 9 statement(s); calls lock(), mappedByteBuffer.position(), mappedByteBuffer.put(), tLock.release(), ioex.printStackTrace(); creates IllegalMemoryAccessException. | |
int writeRegionDirect(byte[] tByte, int tOffset, int tLength) throws IllegalMemoryAccessException | 6 statement(s); calls mappedByteBuffer.position(), mappedByteBuffer.put(); creates IllegalMemoryAccessException. | |
public int writeShort(int tOffset, short tShort) throws IllegalMemoryAccessException | 10 statement(s); calls lock(), mappedByteBuffer.putShort(), tLock.release(), ioex.printStackTrace(); creates IllegalMemoryAccessException. |
class MemorySaveTimer implements Runnable
| Declaration | Value / initializer | Description | Source |
|---|---|---|---|
Thread memorySaveThread | No comment in source; assigned in start(), stop(); used in run(). |
| Signature | Description | Source |
|---|---|---|
MemorySaveTimer() | 2 statement(s); calls super(). |
| Signature | Description | Source |
|---|---|---|
public void run() | 2 statement(s); calls Thread.currentThread(), innerParent.notifyAll(), innerParent.wait(), saveToDevice(). | |
public void start() | 3 statement(s); calls stop(), memorySaveThread.start(); creates Thread. | |
public void stop() | 3 statement(s); calls tThread.interrupt(). |
Fields: attachment, linkFlags, name, next, parentList, prev
Methods: inList(), setName(String)
subclass — ViewMemory.java, line 17
17 public class ViewMemory extends InterProcessMemory implements ViewMemoryConstants,
18 MessagePortConstants, SharedMemoryListener, MemoryInitializer
19 {