Commit Graph

1834 Commits

Author SHA1 Message Date
mdb 14de52cffb As Ray points out, there is danger in allowing any sort of iterating if we
automatically clear entries on get(). Since the point of this is to be a cache
and not to be iterable, we will simply remove all but the safe and necessary
functionality to keep people out of trouble.

Keep it simple! Put things it, get them out. Or not.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1886 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-08-11 01:24:10 +00:00
mdb cc1f0b34ab Implemented a map that maintains soft references to its values so that they may
be garbage collected. If you iterate over the keys, values or entries, you have
to cope with interleaved null values, doing the "right" thing there is a bit
PITA and iterating over the cache is wacky anyway because size() will most
likely never be right (unless we validated every entry in the cache at the time
you called size() which is also wacky).


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1885 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-08-10 23:05:45 +00:00
ray 4fcc4a60eb git-svn-id: https://samskivert.googlecode.com/svn/trunk@1884 6335cc39-0255-0410-8fd6-9bcaacd3b74c 2006-08-08 20:07:47 +00:00
mdb 652ad810f4 Catch any runtime exceptions also thrown by invokePersist().
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1883 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-28 01:31:28 +00:00
mdb 31546d18bd Two extensions of Invoker.Unit that encapsulate a pattern we frequently find
ourselves repeating.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1882 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-27 17:35:12 +00:00
andrzej cddcfa858e Added marshaller for longs.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1881 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-25 18:32:02 +00:00
ray 05054b0d09 Removed bogus line that was a result of a copy/paste error. Ancient!
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1880 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-25 17:49:55 +00:00
mdb 9b5972c1ec Work around Java's goddamned decision to make allocation and initialization
happen at the same time.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1879 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-22 02:07:46 +00:00
mdb 1a8da5bf2d Added append(float[],float).
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1878 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-21 18:52:05 +00:00
mdb 1805b5b9e3 Reuse a session table entry if a user already has one.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1877 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-14 03:33:27 +00:00
mdb b2d95a9541 Propagate the typely goodness.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1876 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-13 00:45:12 +00:00
ray 78a832b7f9 Added a convenience method to get the message of a Throwable, or the
class name if the message is null.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1875 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-12 23:56:00 +00:00
mdb fd7c4d98eb Type safety, formatting.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1874 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-12 23:22:52 +00:00
mdb 73365f4721 It's too hot today. I realize now that what was going on wasn't entirely stupid
as it caught the 0/0 case and freaked out in the >0/0 case. I'll just
sheepishly change this all back and go fix the fucking webapp that's passing
1/0.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1873 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-07 17:15:59 +00:00
mdb 0e38c639ae Third time's the charm.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1872 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-07 17:12:00 +00:00
mdb c3a736890e Ah, actually the documentation begged to differ. Well checking for a zero
numerator is stupid because the math just works, so we'll keep the new behavior
and change the documentation because I'm tired of seeing giant div0 exceptions
in the logs and the fix will no doubt to be to find those places and change
them to display zero if the denominator is zero which is exactly what we're
doing here anyway. It's the new math.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1871 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-07 17:11:45 +00:00
mdb 3e7523cf0c We surely mean to prevent div0 here.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1870 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-07 17:10:08 +00:00
ray ebfaf480f4 No, retroweaver won't catch this. Reverted to the 1.4-compatible constructor.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1869 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-05 19:50:05 +00:00
ray c2bce61bbe Use additional argument to identify the Timer thread. This is 1.5 only,
I'm not sure if retroweaver handles this.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1868 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-05 19:32:08 +00:00
mdb 52af596bf6 git-svn-id: https://samskivert.googlecode.com/svn/trunk@1867 6335cc39-0255-0410-8fd6-9bcaacd3b74c 2006-07-04 22:39:22 +00:00
mdb 436e588a53 Made Queue type safe.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1866 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-07-04 22:27:41 +00:00
mdb 348b3cd5ae Allow XHTML compliant <br/> and <hr/> as well.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1865 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-25 16:35:59 +00:00
mdb 6ca7f04ea5 Moved HTML restriction code into HTMLUtil and out of the overweight StringUtil.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1864 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-25 16:26:04 +00:00
mdb d50d4b8c69 Restored the URL processing.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1863 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-25 16:15:03 +00:00
mdb a9a3cdf220 Switch to a line oriented parsing.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1862 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-25 16:11:29 +00:00
mdb 3b8e79e300 We need the column name.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1861 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-17 21:36:57 +00:00
mdb b181ae231a Make sure we have the column or index before we drop it. Unwrapped a non-long
line.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1860 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-17 21:34:50 +00:00
ray 164c1ac40c Let's remove the deprecated methods so that we don't run into trouble
if retroweaver replaces StringBuilder with StringBuffer (resulting in
duplicate methods).


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1859 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-14 01:20:48 +00:00
mdb 20e50e1635 Added support for referencing other translation messages directly from a
translation message. So you can define something like:

m.coins = Doubloons
m.buy_coins = Purchase {m.coins}

and then later override m.coins and all instances of it will be properly
changed. Very useful for our rebranding efforts.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1858 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-13 22:40:23 +00:00
mdb 98de949beb Pass our site identifier to the message manager regardless of whether we're
using site bundles. The message manager will now allow a simpler form of
site-specific messaging wherein it prefixes the site string to the message
bundle and looks for that (assuming we're not using site bundles).


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1857 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-13 22:11:15 +00:00
ray ed2064ae81 Collection -> Iterable, in a few places.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1856 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-13 22:09:50 +00:00
ray ce7a0f1c9f s/StringBuffer/StringBuilder, where possible.
Deprecated versions of the methods in StringUtil will continue to take
a StringBuffer argument for now.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1855 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-13 21:58:37 +00:00
mdb 9d6c997d8a This is so useful we'll bump it up to samskivert.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1854 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-13 16:53:08 +00:00
ray 4e7017723a Updated createPointComparator to operate on Point2D objects.
Since Point2D objects can have coordinate values between 0 and 1, I had
to remove the wee optimization of comparing the squares of the distance.
Also modified it so that the origin Point's coordinates can be updated to
update the Comparator.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1853 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-09 21:15:33 +00:00
mdb 87753db18a Added batchQuery().
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1852 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-08 21:32:58 +00:00
mdb 0b81f21eea A patch from MikeT to support sending more complex (mime) messages.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1851 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-05 00:45:46 +00:00
mdb 6fc0cf2db0 Cope with very large numbers. Consider that:
int low = Integer.MAX_VALUE - 2;   // = 2147483645
  int high = Integer.MAX_VALUE;      // = 2147483647
  int mid1 = (low + high) / 2;       // = -2
  int mid2 = low + (high - low) / 2; // = 2147483646
  int mid3 = (low + high) >> 1;      // = -2        
  int mid4 = (low + high) >>> 1;     // = 2147483646

So we'll use the last one (non-sign-propagating shift) as it is likely to be
fastest and clearest.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1850 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-06-05 00:13:00 +00:00
mdb 1412f7c5e7 Type-safety patrol!
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1849 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-31 04:30:41 +00:00
ray a1774e073d Following mike's example, let's put the @SuppressWarnings on the same
line as the thing we're suppressing, to more closely couple them.
Also, removed one hanging on a method by using a temporary variable within.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1848 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-31 03:24:35 +00:00
ray e394ddd5a5 Now that we support jdk 1.5, use the T.valueOf() factory methods where T
is Boolean, Byte, Short, Character, Integer, Long, Float, or Double.

This has always made sense for Boolean, but with 1.5 they added these
methods everywhere and they are the preferred method for obtaining an
instance of any of those classes unless you absolutely want different
object references.

Since many Integer objects have a low value, the small bit of overhead
incurred for calling these methods should more than make up for itself
in saved memory and garbage collection time.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1847 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-24 01:18:50 +00:00
mdb f2f1d8e62f Added a handy class for caching things for a spell.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1846 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-20 22:36:17 +00:00
mdb 49cffb85b2 More type safety goodness. It all compiles with no warnings now. Yay!
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1845 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-12 17:54:07 +00:00
mdb 9e898c84a3 More type safety goodness.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1844 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-12 01:27:36 +00:00
ray 93196c5045 Reverted to using an array for our buckets.
Use the @SuppressWarnings annotation with surgical precision.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1843 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-12 01:18:38 +00:00
mdb a043cd1848 Those weren't needed.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1842 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-12 01:17:56 +00:00
mdb e6b7505a69 Ignore unavoidable unchecked warnings.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1841 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-12 01:15:47 +00:00
mdb 20a9e352ee Suppress warnings.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1840 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-12 01:13:46 +00:00
ray 89c9ddb431 Got a wild hair and added some methods to CountHashMap, and added
an Entry interface that can be used to get the count directly from
an Entry (without having to know that values are stored internally as
an int[]). It turned out to be a bit ugly.

What I really need to do is hide all the int[] business by rewriting
this class, which will also clean up the ugliness.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1839 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-05-03 02:28:00 +00:00
mdb 7a4588e859 We need to ensure that only one repository operation is active on a particular
JDBC connection at a time. JDBC connections are thread safe, but we frequently
have to execute statements like:

insert into FOO values(0, blah, blah);
select LAST_INSERTED_ID()

to get the value assigned to an auto-increment column. If another thread
slipped in between those statements and inserted something into its own
auto-increment column having table, we'd get funny business. And indeed we very
occasionally see this race condition happen in the thread-happy webapps.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1838 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-29 18:54:47 +00:00
mdb 5fc9cafc36 Report the key rather than the connection identifier so we can tell if it was
read-only or not.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1837 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2006-04-29 17:58:28 +00:00