edu.utah.janosvm.kit.server.memfs
Class MemoryBlock
java.lang.Object
|
+--edu.utah.janosvm.sys.ListNode
|
+--edu.utah.janosvm.sys.Importable
|
+--edu.utah.janosvm.kit.server.memfs.MemoryBlock
- final class MemoryBlock
- extends Importable
A fault tolerant handle for a MemoryBlockBackEnd.
Field Summary |
private MemoryBlockBackEnd |
be
The exportable. |
private static long |
CONNECT_DELAY
The number of milliseconds to wait before retrying to connect to the
server. |
private static int |
CONNECT_RETRIES
The number of times to try connecting to the server. |
private java.lang.String |
fileName
The name of the block to import. |
private static java.lang.Class |
THIS_CLASS
Pointer to this class, used for set/getClassLocal. |
Fields inherited from class edu.utah.janosvm.sys.Importable |
em |
Constructor Summary |
(package private) |
MemoryBlock(java.lang.String fileName)
Construct a MemoryBlock handle that will import the MemoryBlockBackEnd
with the given name. |
Method Summary |
protected void |
bindTo(Exportable ex)
Bind this Importable to the given Exportable. |
(package private) void |
connect(boolean create)
A fault tolerant method for connecting to the server and the exported
object. |
(package private) boolean |
delete()
|
(package private) boolean |
isConnected()
|
(package private) int |
read(int cursor,
byte[] buffer,
int offset,
int length)
|
(package private) void |
sync()
Force a write to disk of the whole MemoryFileSystem. |
java.lang.String |
toString()
|
protected void |
unbindFrom()
Unbind this Importable from any objects its referencing. |
(package private) void |
write(int cursor,
byte[] buffer,
int offset,
int length)
|
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait,
wait0 |
THIS_CLASS
private static final java.lang.Class THIS_CLASS
- Pointer to this class, used for set/getClassLocal.
CONNECT_DELAY
private static final long CONNECT_DELAY
- The number of milliseconds to wait before retrying to connect to the
server.
CONNECT_RETRIES
private static final int CONNECT_RETRIES
- The number of times to try connecting to the server.
fileName
private final java.lang.String fileName
- The name of the block to import.
be
private MemoryBlockBackEnd be
- The exportable.
MemoryBlock
MemoryBlock(java.lang.String fileName)
- Construct a MemoryBlock handle that will import the MemoryBlockBackEnd
with the given name.
- Parameters:
fileName
- The name of the MemoryBlockBackEnd to import.
bindTo
protected void bindTo(Exportable ex)
- Description copied from class: Importable
- Bind this Importable to the given Exportable. The most common
implementation of this method would be to cast the Exportable to the
type that the Importable subclass handles and store it in the object as
well as any other handy pointers/values.
- Overrides:
- bindTo in class Importable
- Tags copied from class: Importable
- Parameters:
ex
- The Exportable that is being imported.
unbindFrom
protected void unbindFrom()
- Description copied from class: Importable
- Unbind this Importable from any objects its referencing. The most
common implementation of this method would be null out any object
references in this object.
- Overrides:
- unbindFrom in class Importable
isConnected
boolean isConnected()
- Returns:
- True if the handle is connected to an export.
connect
void connect(boolean create)
throws java.io.FileNotFoundException
- A fault tolerant method for connecting to the server and the exported
object.
- Parameters:
create
- Create the object if it doesn't already exist.- Throws:
- Throws - FileNotFoundException if the file couldn't be found
and create is false or if the method was unable to connect to the
server.
read
int read(int cursor,
byte[] buffer,
int offset,
int length)
throws DeadTeamException
- Parameters:
cursor
- The offset to read from the file.buffer
- The buffer to read the data into.offset
- The offset into buffer to start reading.length
- The number of bytes to read into buffer.- Returns:
- The number of bytes read.
- Throws:
- Throws - a DeadTeamException if the import has been revoked.
write
void write(int cursor,
byte[] buffer,
int offset,
int length)
throws DeadTeamException,
TeamEjectionException
- Parameters:
cursor
- The offset to start writing into the file.buffer
- The buffer to read the data to write.offset
- The offset into buffer to start reading.length
- The number of bytes to write into buffer.- Throws:
- Throws - a DeadTeamException if the import has been revoked or
the server team is unreachable.
- Throws - a TeamEjectionException if the thread was ejected
during processing.
delete
boolean delete()
throws DeadTeamException,
TeamEjectionException
- Returns:
- True if the file was deleted from the file system.
sync
void sync()
throws DeadTeamException,
TeamEjectionException,
java.io.IOException
- Force a write to disk of the whole MemoryFileSystem.
toString
public java.lang.String toString()
- Overrides:
- toString in class Importable
This documentation is Copyright (C) 2000-2002 The University of Utah. All Rights Reserved. See the documentation license for distribution terms and restrictions.
Documentation, software, and mailing lists for the JanosVM can be found at the Janos Project web page: http://www.cs.utah.edu/flux/janos/
Generated on Mar 17, 2002