org.sapia.ubik.rmi.server.gc
Class ServerGC

java.lang.Object
  extended by org.sapia.ubik.rmi.server.gc.ServerGC
All Implemented Interfaces:
MBeanFactory, ServerGCMBean, Task

public class ServerGC
extends java.lang.Object
implements Task, ServerGCMBean, MBeanFactory

This class implements the server-side distributed garbage collection algorithm.

Author:
Yanick Duchesne 2002-08-09

Field Summary
static long GC_INTERVAL
           
static long GC_TIMEOUT
           
 
Constructor Summary
ServerGC(TaskManager taskman)
          Creates a new ServerGC instance.
 
Method Summary
 void clear()
           
 boolean containsClient(VmId id)
          Returns true if this instance contains the passed in VmId.
 MBeanContainer createMBean()
          Internally creates a MBean and its ObjectName, that are returned in a MBeanContainer.
 void dereference(VmId id, OID oid)
          Dereferences a given object identifier.
 void exec(TaskContext ctx)
           
 int getClientCount()
           
 long getInterval()
           
 int getRefCount(VmId id, OID oid)
          Returns the total number of references held on the given object identifier.
 int getSpecificCount(VmId id, OID oid)
          Returns the total number of references held on the given object by the client whose host corresponds to the passed in VmId.
 long getTimeout()
           
 void reference(VmId id, OID oid)
          Increments the reference count of the given object identifier, for the client whose VmId is given.
 void registerRef(VmId id, OID oid, java.lang.Object o)
          Registers a given object internally so that it is not garbage collected before clients themselves garbage collect it.
 void setTimeout(long timeout)
           
 void touch(VmId id)
          Touches the client info of the vm id passed in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GC_TIMEOUT

public static final long GC_TIMEOUT
See Also:
Constant Field Values

GC_INTERVAL

public static final long GC_INTERVAL
See Also:
Constant Field Values
Constructor Detail

ServerGC

public ServerGC(TaskManager taskman)
Creates a new ServerGC instance.

Parameters:
taskman -
Method Detail

getRefCount

public int getRefCount(VmId id,
                       OID oid)
Returns the total number of references held on the given object identifier.

Parameters:
id - a VmId.
oid - an OID.
Returns:
a reference count, as an int.

getSpecificCount

public int getSpecificCount(VmId id,
                            OID oid)
Returns the total number of references held on the given object by the client whose host corresponds to the passed in VmId.


containsClient

public boolean containsClient(VmId id)
Returns true if this instance contains the passed in VmId.

Returns:
true if this instance contains the passed in VmId.

reference

public void reference(VmId id,
                      OID oid)
Increments the reference count of the given object identifier, for the client whose VmId is given.

Parameters:
address - the client's VmId.
oid - the object identifier of whose reference count to increment.

registerRef

public void registerRef(VmId id,
                        OID oid,
                        java.lang.Object o)
Registers a given object internally so that it is not garbage collected before clients themselves garbage collect it.

Parameters:
id - the VmId of the client to whom a stub corresponding to the passed in object is returned (this in fact creates a remote reference on the object).
oid - the OID that identifies the passed in object locally.
the - object for which a stub is eventually returned to the client.

dereference

public void dereference(VmId id,
                        OID oid)
Dereferences a given object identifier.

Parameters:
id - the VmId of the client from which the dereferencing call comes.
oid - the OID to dereference.

touch

public void touch(VmId id)
Touches the client info of the vm id passed in.

Parameters:
id -

exec

public void exec(TaskContext ctx)
Specified by:
exec in interface Task
Parameters:
ctx - this instance's TaskContext

clear

public void clear()

getInterval

public long getInterval()
Specified by:
getInterval in interface ServerGCMBean
See Also:
Consts.SERVER_GC_INTERVAL

getTimeout

public long getTimeout()
Specified by:
getTimeout in interface ServerGCMBean
See Also:
Consts.SERVER_GC_TIMEOUT

setTimeout

public void setTimeout(long timeout)
Specified by:
setTimeout in interface ServerGCMBean

getClientCount

public int getClientCount()
Specified by:
getClientCount in interface ServerGCMBean
Returns:
the number of clients that the server GC keeps track of.

createMBean

public MBeanContainer createMBean()
                           throws java.lang.Exception
Description copied from interface: MBeanFactory
Internally creates a MBean and its ObjectName, that are returned in a MBeanContainer.

Specified by:
createMBean in interface MBeanFactory
Returns:
a MBeanContainer
Throws:
java.lang.Exception - if a problem occurs while creating the MBean or its object name.


Copyright © 2010 Sapia OSS. All Rights Reserved.