|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.remoting.CallbackStore
Acts as a persistent list which writes Serializable objects to disk and will retrieve them in same order in which they were added (FIFO). Each file will be named according to the current time (using System.currentTimeMillis() with the file suffix specified (see below). When the object is read and returned by calling the getNext() method, the file on disk for that object will be deleted. If for some reason the store VM crashes, the objects will still be available upon next startup.
The attributes to make sure to configure are: file path - this determins which directory to write the objects. The default value is the property value of 'jboss.server.data.dir' and if this is not set, then will be 'data'. For example, might be /jboss/server/default/data.file suffix - the file suffix to use for the file written for each object stored.
This is also a service mbean, so can be run as a service within JBoss AS or stand alone.
Nested Class Summary | |
class |
CallbackStore.StoreFileFilter
|
Field Summary | |
static String |
FILE_PATH_KEY
|
static String |
FILE_SUFFIX_KEY
|
Constructor Summary | |
CallbackStore()
Default store constructor. |
|
CallbackStore(boolean purgeOnDestroy)
Store constructor. |
Method Summary | |
void |
add(Serializable object)
Persists the serializable object passed to the directory specified. |
void |
create()
This is a no op method, but needed in order to be used as a service within JBoss AS. |
void |
destroy()
If purgeOnDestroy is true, will remove files upon shutdown. |
Object |
getNext()
Will look through the files in the store directory for the oldest object serialized to disk, load it, delete the file, and return the deserialized object. |
boolean |
getPurgeOnShutdown()
Returns if store will clean up persisted files when shutdown (destroy()). |
String |
getStoreFilePath()
Gets the file path for the directory where the objects will be stored. |
String |
getStoreFileSuffix()
Gets the file suffix for each of the files that objects will be persisted to. |
void |
purgeFiles()
|
void |
setConfig(Map config)
Will use the values in the map to set configuration. |
void |
setPurgeOnShutdown(boolean purgeOnShutdown)
Sets if store should clean up persisted files when shutdown (destroy()). |
void |
setStoreFilePath(String filePath)
Sets teh file path for the directory where the objects will be stored. |
void |
setStoreFileSuffix(String fileSuffix)
Sets the file suffix for each of the files that objects will be persisted to. |
int |
size()
Getst the number of objects stored and available. |
void |
start()
Will get the file path value (if not already set will just use the default setting) and will create the directory specified by the file path if it does not already exist. |
void |
stop()
This will allow for change of file suffix and file path and then may start again using these new values. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String FILE_PATH_KEY
public static final String FILE_SUFFIX_KEY
Constructor Detail |
public CallbackStore()
public CallbackStore(boolean purgeOnDestroy)
purgeOnDestroy
- if true, will remove all persisted objects from disk on when destroy() is called, else
will leave the files (which is the default behaviour).Method Detail |
public void start() throws Exception
start
in interface SerializableStore
Exception
public void setPurgeOnShutdown(boolean purgeOnShutdown)
setPurgeOnShutdown
in interface SerializableStore
purgeOnShutdown
- public boolean getPurgeOnShutdown()
getPurgeOnShutdown
in interface SerializableStore
public void create() throws Exception
create
in interface SerializableStore
Exception
public void stop()
stop
in interface SerializableStore
public void destroy()
destroy
in interface SerializableStore
public void purgeFiles()
purgeFiles
in interface SerializableStore
public void setConfig(Map config)
setConfig
in interface SerializableStore
config
- public String getStoreFilePath()
getStoreFilePath
in interface CallbackStoreMBean
public void setStoreFilePath(String filePath)
setStoreFilePath
in interface CallbackStoreMBean
filePath
- public String getStoreFileSuffix()
getStoreFileSuffix
in interface CallbackStoreMBean
public void setStoreFileSuffix(String fileSuffix)
setStoreFileSuffix
in interface CallbackStoreMBean
fileSuffix
- public int size()
size
in interface SerializableStore
public Object getNext() throws IOException
getNext
in interface SerializableStore
IOException
public void add(Serializable object) throws IOException
add
in interface SerializableStore
object
-
IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |