[jsword-svn] r1429 - in trunk: common/src/main/java/org/crosswire/common/util jsword-limbo/src/main/java/org/crosswire/common/util
dmsmith at www.crosswire.org
dmsmith at www.crosswire.org
Fri Jun 22 10:37:41 MST 2007
Author: dmsmith
Date: 2007-06-22 10:37:41 -0700 (Fri, 22 Jun 2007)
New Revision: 1429
Added:
trunk/common/src/main/java/org/crosswire/common/util/TimeGate.java
trunk/jsword-limbo/src/main/java/org/crosswire/common/util/LimboMsg.java
trunk/jsword-limbo/src/main/java/org/crosswire/common/util/LimboMsg.properties
Log:
made awt exceptions be infrequently reported.
Moved some messages to limbo.
Added: trunk/common/src/main/java/org/crosswire/common/util/TimeGate.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/TimeGate.java (rev 0)
+++ trunk/common/src/main/java/org/crosswire/common/util/TimeGate.java 2007-06-22 17:37:41 UTC (rev 1429)
@@ -0,0 +1,73 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program 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 Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ * http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2007
+ * The copyright to this program is held by it's authors.
+ *
+ * ID: $Id: org.eclipse.jdt.ui.prefs 1178 2006-11-06 12:48:02Z dmsmith $
+ */
+
+package org.crosswire.common.util;
+
+/**
+ * A TimeGate when entered will cause the gate to be closed for a specified period of time.
+ *
+ * @see gnu.lgpl.License for license details.<br>
+ * The copyright to this program is held by it's authors.
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public class TimeGate
+{
+ /**
+ * Build a TimeGate that will allow entry no more often than count milliseconds
+ * @param count the length of time to keep the gate shut after opening it.
+ */
+ public TimeGate(int count)
+ {
+ closeTime = count;
+ }
+
+ /**
+ * Determine whether entry through the gate is allowed.
+ * Opening the gate will close it until the TimeGate's interval has passed.
+ * @return true if one may enter.
+ */
+ public synchronized boolean open()
+ {
+ // check to see if the gate has been closed long enough.
+ // If so, then open it and note the time that it was opened.
+ long now = System.currentTimeMillis();
+ if (now - then > closeTime)
+ {
+ then = now;
+ return true;
+ }
+
+ // Otherwise the gate was opened not that long ago and
+ // is still closed.
+ return false;
+ }
+
+ /**
+ * The interval during which the gate is closed.
+ */
+ private int closeTime;
+
+ /**
+ * The time in milliseconds that the gate last closed.
+ */
+ private long then;
+}
Added: trunk/jsword-limbo/src/main/java/org/crosswire/common/util/LimboMsg.java
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/common/util/LimboMsg.java (rev 0)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/common/util/LimboMsg.java 2007-06-22 17:37:41 UTC (rev 1429)
@@ -0,0 +1,43 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program 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 Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ * http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ * The copyright to this program is held by it's authors.
+ *
+ * ID: $Id: Msg.java 1426 2007-06-22 02:46:03Z dmsmith $
+ */
+package org.crosswire.common.util;
+
+/**
+ * Compile safe Msg resource settings.
+ *
+ * @see gnu.lgpl.License for license details.<br>
+ * The copyright to this program is held by it's authors.
+ * @author Joe Walker [joe at eireneh dot com]
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+final class LimboMsg extends MsgBase
+{
+ static final LimboMsg UNAVILABLE = new LimboMsg("ThreadUtil.Unavailable"); //$NON-NLS-1$
+
+ /**
+ * Passthrough ctor
+ */
+ private LimboMsg(String name)
+ {
+ super(name);
+ }
+}
Added: trunk/jsword-limbo/src/main/java/org/crosswire/common/util/LimboMsg.properties
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/common/util/LimboMsg.properties (rev 0)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/common/util/LimboMsg.properties 2007-06-22 17:37:41 UTC (rev 1429)
@@ -0,0 +1,8 @@
+# The naming convention for the keys in the file is ClassName.MessageName
+# Where ClassName is the name of the class using the property.
+# When the resource is used by more than one class it should be the one
+# that the resource is most closely associated.
+# The MessageName should be mixed case, with a leading capital.
+# It should have no spaces or other punctuation (e.g. _, -, ', ...)
+
+ThreadUtil.Unavailable=<Unavailable>
More information about the jsword-svn
mailing list