|
From: <lh...@us...> - 2010-06-03 18:39:30
|
Revision: 396
http://tinytim.svn.sourceforge.net/tinytim/?rev=396&view=rev
Author: lheuer
Date: 2010-06-03 18:39:23 +0000 (Thu, 03 Jun 2010)
Log Message:
-----------
Avoid out of memory errors due to the usage of interned strings
Modified Paths:
--------------
tinytim/trunk/src/main/java/org/tinytim/core/IdentityManager.java
tinytim/trunk/src/main/java/org/tinytim/core/value/LocatorImpl.java
Modified: tinytim/trunk/src/main/java/org/tinytim/core/IdentityManager.java
===================================================================
--- tinytim/trunk/src/main/java/org/tinytim/core/IdentityManager.java 2010-05-01 10:43:16 UTC (rev 395)
+++ tinytim/trunk/src/main/java/org/tinytim/core/IdentityManager.java 2010-06-03 18:39:23 UTC (rev 396)
@@ -50,7 +50,7 @@
private final Map<String, IConstruct> _id2Construct;
IdentityManager(MemoryTopicMap tm) {
- _id2Construct = CollectionFactory.createIdentityMap(IConstant.IDENTITY_ID2CONSTRUCT_SIZE);
+ _id2Construct = CollectionFactory.createMap(IConstant.IDENTITY_ID2CONSTRUCT_SIZE);
_sid2Topic = CollectionFactory.createIdentityMap(IConstant.IDENTITY_SID2TOPIC_SIZE);
_slo2Topic = CollectionFactory.createIdentityMap(IConstant.IDENTITY_SLO2TOPIC_SIZE);
_iid2Construct = CollectionFactory.createIdentityMap(IConstant.IDENTITY_IID2CONSTRUCT_SIZE);
@@ -107,7 +107,7 @@
private void _register(IConstruct construct) {
ConstructImpl c = (ConstructImpl) construct;
if (c._id == null) {
- c._id = String.valueOf(IdGenerator.nextId()).intern();
+ c._id = String.valueOf(IdGenerator.nextId());
}
if (!_id2Construct.containsKey(c._id)) {
_id2Construct.put(c._id, c);
Modified: tinytim/trunk/src/main/java/org/tinytim/core/value/LocatorImpl.java
===================================================================
--- tinytim/trunk/src/main/java/org/tinytim/core/value/LocatorImpl.java 2010-05-01 10:43:16 UTC (rev 395)
+++ tinytim/trunk/src/main/java/org/tinytim/core/value/LocatorImpl.java 2010-06-03 18:39:23 UTC (rev 396)
@@ -63,7 +63,7 @@
catch (UnsupportedEncodingException ex) {
throw new TMAPIRuntimeException(ex);
}
- _uri = URI.create(_reference.replace(" ", "%20"));
+ _uri = URI.create(reference);
}
private LocatorImpl(URI uri) {
@@ -79,6 +79,7 @@
/* (non-Javadoc)
* @see org.tinytim.internal.api.ILiteral#getDatatype()
*/
+ @Override
public Locator getDatatype() {
return XSD.ANY_URI;
}
@@ -86,6 +87,7 @@
/* (non-Javadoc)
* @see org.tinytim.internal.api.ILiteral#getValue()
*/
+ @Override
public String getValue() {
return _reference;
}
@@ -93,6 +95,7 @@
/* (non-Javadoc)
* @see org.tinytim.internal.api.ILiteral#decimalValue()
*/
+ @Override
public BigDecimal decimalValue() {
throw new NumberFormatException();
}
@@ -100,6 +103,7 @@
/* (non-Javadoc)
* @see org.tinytim.internal.api.ILiteral#floatValue()
*/
+ @Override
public float floatValue() {
throw new NumberFormatException();
}
@@ -107,6 +111,7 @@
/* (non-Javadoc)
* @see org.tinytim.internal.api.ILiteral#integerValue()
*/
+ @Override
public BigInteger integerValue() {
throw new NumberFormatException();
}
@@ -114,6 +119,7 @@
/* (non-Javadoc)
* @see org.tinytim.internal.api.ILiteral#intValue()
*/
+ @Override
public int intValue() {
throw new NumberFormatException();
}
@@ -121,6 +127,7 @@
/* (non-Javadoc)
* @see org.tinytim.internal.api.ILiteral#longValue()
*/
+ @Override
public long longValue() {
throw new NumberFormatException();
}
@@ -128,6 +135,7 @@
/* (non-Javadoc)
* @see org.tmapi.core.Locator#getReference()
*/
+ @Override
public String getReference() {
return _reference;
}
@@ -135,13 +143,18 @@
/* (non-Javadoc)
* @see org.tmapi.core.Locator#resolve(java.lang.String)
*/
+ @Override
public Locator resolve(String reference) {
+ if (_EMPTY.equals(reference)) {
+ return this;
+ }
return create(_uri.resolve(reference));
}
/* (non-Javadoc)
* @see org.tmapi.core.Locator#toExternalForm()
*/
+ @Override
public String toExternalForm() {
return _uri.toASCIIString();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|