summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAudrius Meskauskas <audriusa@Bioinformatics.org>2006-03-04 18:45:59 +0000
committerAudrius Meskauskas <audriusa@Bioinformatics.org>2006-03-04 18:45:59 +0000
commitfb39a389a8f02a9aecbb7aca8945e26b1ffc301f (patch)
treed4153d4db10de1322002de70d6cac4582388a21a
parent8302c9d576000364d8f167b3a8646cb6595c91c4 (diff)
downloadclasspath-fb39a389a8f02a9aecbb7aca8945e26b1ffc301f.tar.gz
2006-03-04 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/java/rmi/dgc/DGCImpl.java: More comments, boilerplate fix. * java/rmi/dgc/Lease.java: Boilerplate fix.
-rw-r--r--ChangeLog11
-rw-r--r--gnu/java/rmi/dgc/DGCImpl.java122
-rw-r--r--java/rmi/dgc/Lease.java72
3 files changed, 110 insertions, 95 deletions
diff --git a/ChangeLog b/ChangeLog
index e1a2a9424..97371563c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-03-04 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/java/rmi/dgc/DGCImpl.java: More comments, boilerplate fix.
+ * java/rmi/dgc/Lease.java: Boilerplate fix.
+
2006-03-05 Raif S. Naffah <raif@swiftdsl.com.au>
* java/util/jar/Attributes.java (putValue): Made it public and updated
@@ -297,9 +302,9 @@
2006-03-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
- * gnu/java/rmi/dgc/DGCImpl.java,
- java/rmi/dgc/DGC.java,
- java/rmi/dgc/Lease.java: Formatted and commented.
+ * gnu/java/rmi/dgc/DGCImpl.java,
+ java/rmi/dgc/DGC.java,
+ java/rmi/dgc/Lease.java: Formatted and commented.
2006-03-03 Roman Kennke <kennke@aicas.com>
diff --git a/gnu/java/rmi/dgc/DGCImpl.java b/gnu/java/rmi/dgc/DGCImpl.java
index 96b9b8bcc..a7bc0940e 100644
--- a/gnu/java/rmi/dgc/DGCImpl.java
+++ b/gnu/java/rmi/dgc/DGCImpl.java
@@ -1,41 +1,40 @@
/* DGCImpl.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2005
- Free Software Foundation, Inc.
-
- This file is part of GNU Classpath.
-
- GNU Classpath is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- GNU Classpath is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU Classpath; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301 USA.
-
- Linking this library statically or dynamically with other modules is
- making a combined work based on this library. Thus, the terms and
- conditions of the GNU General Public License cover the whole
- combination.
-
- As a special exception, the copyright holders of this library give you
- permission to link this library with independent modules to produce an
- executable, regardless of the license terms of these independent
- modules, and to copy and distribute the resulting executable under
- terms of your choice, provided that you also meet, for each linked
- independent module, the terms and conditions of the license of that
- module. An independent module is a module which is not derived from
- or based on this library. If you modify this library, you may extend
- this exception to your version of the library, but you are not
- obligated to do so. If you do not wish to do so, delete this
- exception statement from your version. */
-
+ Copyright (c) 1996, 1997, 1998, 1999, 2002, 2005
+ Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
package gnu.java.rmi.dgc;
@@ -67,11 +66,15 @@ public class DGCImpl
* The DGCImpl extends UnicastServerRef and not UnicastRemoteObject, because
* UnicastRemoteObject must exportObject automatically.
*/
-
- private static final long LEASE_VALUE = 600000L;
+
+ /**
+ * This defauld lease value is used if the lease value, passed to the
+ * {@link #dirty} is equal to zero.
+ */
+ static final long LEASE_VALUE = 600000L;
// leaseCache caches a LeaseRecord associated with a vmid
- private Hashtable leaseCache = new Hashtable();
+ Hashtable leaseCache = new Hashtable();
public DGCImpl() throws RemoteException
{
@@ -90,24 +93,24 @@ public class DGCImpl
public Lease dirty(ObjID[] ids, long sequenceNum, Lease lease)
throws RemoteException
{
- System.out.println("Dirty for "+lease.getValue());
VMID vmid = lease.getVMID();
if (vmid == null)
vmid = new VMID();
- long leaseValue = LEASE_VALUE;
- // long leaseValue = lease.getValue();
+
+ long leaseValue = lease.getValue();
+ if (leaseValue <= 0)
+ leaseValue = LEASE_VALUE;
+
lease = new Lease(vmid, leaseValue);
- synchronized (leaseCache)
+ LeaseRecord lr = (LeaseRecord) leaseCache.get(vmid);
+ if (lr != null)
+ lr.reset(leaseValue);
+ else
{
- LeaseRecord lr = (LeaseRecord) leaseCache.get(vmid);
- if (lr != null)
- lr.reset(leaseValue);
- else
- {
- lr = new LeaseRecord(vmid, leaseValue);
- leaseCache.put(vmid, lr);
- }
+ lr = new LeaseRecord(vmid, leaseValue, ids);
+ leaseCache.put(vmid, lr);
}
+
return (lease);
}
@@ -130,17 +133,23 @@ public class DGCImpl
/**
* LeaseRecord associates a vmid to expireTime.
*/
- private static class LeaseRecord
+ static class LeaseRecord
{
/**
* The lease id.
*/
- private VMID vmid;
+ final VMID vmid;
/**
* The lease expiration time.
*/
- private long expireTime;
+ long expireTime;
+
+ /**
+ * The array of ObjeID's that must be protected from being garbage
+ * collected.
+ */
+ final ObjID [] objects;
/**
* Create the new lease record.
@@ -148,10 +157,11 @@ public class DGCImpl
* @param vmid lease id.
* @param leaseValue lease value
*/
- LeaseRecord(VMID vmid, long leaseValue)
+ LeaseRecord(VMID vmid, long leaseValue, ObjID [] an_objects)
{
this.vmid = vmid;
reset(leaseValue);
+ objects = an_objects;
}
/**
diff --git a/java/rmi/dgc/Lease.java b/java/rmi/dgc/Lease.java
index 7f53fe3fd..36ff12ad2 100644
--- a/java/rmi/dgc/Lease.java
+++ b/java/rmi/dgc/Lease.java
@@ -1,40 +1,40 @@
/* Lease.java
- Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
-
- This file is part of GNU Classpath.
-
- GNU Classpath is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- GNU Classpath is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU Classpath; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301 USA.
-
- Linking this library statically or dynamically with other modules is
- making a combined work based on this library. Thus, the terms and
- conditions of the GNU General Public License cover the whole
- combination.
-
- As a special exception, the copyright holders of this library give you
- permission to link this library with independent modules to produce an
- executable, regardless of the license terms of these independent
- modules, and to copy and distribute the resulting executable under
- terms of your choice, provided that you also meet, for each linked
- independent module, the terms and conditions of the license of that
- module. An independent module is a module which is not derived from
- or based on this library. If you modify this library, you may extend
- this exception to your version of the library, but you are not
- obligated to do so. If you do not wish to do so, delete this
- exception statement from your version. */
-
+ Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
package java.rmi.dgc;