com.rhi.architecture.resource.shmem
Class PersistentSharedMemory

java.lang.Object
  extended bycom.rhi.architecture.resource.shmem.PersistentSharedMemory
All Implemented Interfaces:
Resource, SharedMemory

public class PersistentSharedMemory
extends java.lang.Object
implements SharedMemory

Object used to share memory between threads. The shared memory is persisted to a file.

Author:
geolun01

Constructor Summary
PersistentSharedMemory()
           
 
Method Summary
 void close()
          Set our shared data to null
 java.lang.Object getSharedData()
          Returns the sharedData.
 void init(java.util.Properties props)
          No initialization is required
 void setPersistenceFile(java.lang.String fileName)
          Sets the file to be used to persist the stored object.
 void setSharedData(java.lang.Object sharedData)
          Sets the sharedData and then persists it to a file, if the file is available
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentSharedMemory

public PersistentSharedMemory()
Method Detail

init

public void init(java.util.Properties props)
No initialization is required

Specified by:
init in interface Resource
Parameters:
props -

close

public void close()
Set our shared data to null

Specified by:
close in interface Resource
See Also:
Resource.close()

setPersistenceFile

public void setPersistenceFile(java.lang.String fileName)
                        throws java.io.IOException,
                               java.lang.ClassNotFoundException
Sets the file to be used to persist the stored object. Any calls after the first call are ignored assuming the first call was successful.

Parameters:
fileName - Name of the file to be used for persistance
Throws:
java.io.IOException - Thrown if an error occurs while reading from the file
java.lang.ClassNotFoundException - Thrown if the loaded object's class cannot be found

setSharedData

public void setSharedData(java.lang.Object sharedData)
                   throws java.io.IOException
Sets the sharedData and then persists it to a file, if the file is available

Specified by:
setSharedData in interface SharedMemory
Parameters:
sharedData - The sharedData to set
Throws:
java.io.IOException - Thrown if an error occurs while writing to the file

getSharedData

public java.lang.Object getSharedData()
Returns the sharedData.

Specified by:
getSharedData in interface SharedMemory
Returns:
Object


Copyright © 2002-2004 Robert Half International. All Rights Reserved.