goodsjpi
Class Storage

java.lang.Object
  extended bygoodsjpi.Storage
All Implemented Interfaces:
java.lang.Runnable

public class Storage
extends java.lang.Object
implements java.lang.Runnable

Client interface with storage server


Field Summary
protected  goodsjpi.ClassDescriptor[] classDictionary
           
protected  int classDictionarySize
           
protected  boolean closing
           
protected  int[] cpidTable
           
protected  int cpidTableSize
           
protected  java.lang.Object cs
           
protected  Database database
           
protected  Persistent freeList
           
protected  int id
           
protected  java.io.InputStream in
           
static int initTransBufferSize
           
static int LingerTime
           
protected  Persistent loadList
           
static int maxTransBufferSize
           
protected  byte[] notification
           
protected  ObjectCache objectCache
           
protected  java.io.OutputStream out
           
protected  CondEvent rcvEvent
           
protected  PThread receiver
           
protected  CondEvent repEvent
           
protected  byte[] reply
           
protected  byte[] request
           
protected  java.lang.Object requestMutex
           
protected  byte[] result
           
protected  Persistent root
           
protected  java.net.Socket socket
           
protected  byte[] transBuffer
           
protected  int transBufferOffs
           
 
Constructor Summary
protected Storage(Database db, int sid)
           
 
Method Summary
protected  void abortTransaction()
           
protected  void allocate(Persistent obj, int align)
           
protected  void changeClass(int cpid, byte[] desc)
           
protected  void close()
           
protected  void commitSubtransaction(Storage coordinator, int nTransServers, Storage[] servers, int tid)
           
protected  int commitTransaction(int nTransServers, Storage[] servers)
           
protected  void createWeakObjectCache()
           
protected  void deallocate(Persistent obj)
           
protected  void forgetObject(Persistent obj)
           
protected  void forgetObjects(int[] opids)
           
protected  byte[] getClass(int cpid)
           
protected  Persistent getObject(int id)
           
protected  Persistent getRoot()
           
protected  long getSize()
           
protected  boolean isInvolvedInTransaction()
           
protected  Persistent load(int opid, Persistent obj)
           
protected  boolean lock(Persistent obj, int lockType, int lockAttr)
           
protected  void open(java.lang.String host, int port)
           
protected  void read(byte[] buf, int size)
           
protected  Persistent readObject(Persistent obj, byte[] buffer, int offs)
           
protected  int registerClass(byte[] desc)
           
 void run()
           
protected  void sendReceive(byte[] req, int expectedCmd)
           
protected  void sendReceive(byte[] req, int len, int expectedCmd)
           
protected  byte[] sendReceiveBody(byte[] req, int expectedCmd)
           
protected  byte[] sendReceiveBody(byte[] req, int len, int expectedCmd)
           
protected  void setRoot(Persistent root)
           
protected  void store(Persistent obj)
           
protected  void throwObject(Persistent obj)
           
protected  void unlock(Persistent obj, int lockType)
           
protected  boolean waitTransactionCompletion()
           
protected  void write(byte[] buf, int size)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

protected int id

database

protected Database database

socket

protected java.net.Socket socket

in

protected java.io.InputStream in

out

protected java.io.OutputStream out

LingerTime

public static int LingerTime

result

protected byte[] result

notification

protected byte[] notification

reply

protected byte[] reply

request

protected byte[] request

classDictionary

protected goodsjpi.ClassDescriptor[] classDictionary

classDictionarySize

protected int classDictionarySize

cpidTable

protected int[] cpidTable

cpidTableSize

protected int cpidTableSize

loadList

protected Persistent loadList

freeList

protected Persistent freeList

cs

protected java.lang.Object cs

requestMutex

protected java.lang.Object requestMutex

root

protected Persistent root

rcvEvent

protected CondEvent rcvEvent

repEvent

protected CondEvent repEvent

transBuffer

protected byte[] transBuffer

transBufferOffs

protected int transBufferOffs

initTransBufferSize

public static int initTransBufferSize

maxTransBufferSize

public static int maxTransBufferSize

objectCache

protected ObjectCache objectCache

closing

protected volatile boolean closing

receiver

protected PThread receiver
Constructor Detail

Storage

protected Storage(Database db,
                  int sid)
Method Detail

createWeakObjectCache

protected void createWeakObjectCache()

getObject

protected Persistent getObject(int id)

load

protected Persistent load(int opid,
                          Persistent obj)

store

protected void store(Persistent obj)

abortTransaction

protected void abortTransaction()

isInvolvedInTransaction

protected boolean isInvolvedInTransaction()

readObject

protected Persistent readObject(Persistent obj,
                                byte[] buffer,
                                int offs)

getRoot

protected Persistent getRoot()

setRoot

protected void setRoot(Persistent root)

run

public void run()
Specified by:
run in interface java.lang.Runnable

write

protected void write(byte[] buf,
                     int size)

read

protected void read(byte[] buf,
                    int size)

sendReceive

protected final void sendReceive(byte[] req,
                                 int expectedCmd)

sendReceive

protected void sendReceive(byte[] req,
                           int len,
                           int expectedCmd)

sendReceiveBody

protected final byte[] sendReceiveBody(byte[] req,
                                       int expectedCmd)

sendReceiveBody

protected byte[] sendReceiveBody(byte[] req,
                                 int len,
                                 int expectedCmd)

lock

protected boolean lock(Persistent obj,
                       int lockType,
                       int lockAttr)

unlock

protected void unlock(Persistent obj,
                      int lockType)

allocate

protected void allocate(Persistent obj,
                        int align)

deallocate

protected void deallocate(Persistent obj)

registerClass

protected int registerClass(byte[] desc)

getClass

protected byte[] getClass(int cpid)

changeClass

protected void changeClass(int cpid,
                           byte[] desc)

throwObject

protected void throwObject(Persistent obj)

forgetObject

protected void forgetObject(Persistent obj)

forgetObjects

protected void forgetObjects(int[] opids)

commitTransaction

protected int commitTransaction(int nTransServers,
                                Storage[] servers)

commitSubtransaction

protected void commitSubtransaction(Storage coordinator,
                                    int nTransServers,
                                    Storage[] servers,
                                    int tid)

waitTransactionCompletion

protected boolean waitTransactionCompletion()

open

protected void open(java.lang.String host,
                    int port)
             throws java.io.IOException
Throws:
java.io.IOException

close

protected void close()

getSize

protected long getSize()