Replace StringBuffer with StringBuilder
avoid unnecessary synchronization
This commit is contained in:
parent
7f6ead80cc
commit
4499abd9a9
|
@ -61,8 +61,7 @@ public class DefaultComponentSafeNamingStrategy extends EJB3NamingStrategy {
|
|||
return tableName;
|
||||
}
|
||||
else {
|
||||
//use of a stringbuffer to workaround a JDK bug
|
||||
return new StringBuffer( ownerEntityTable ).append( "_" )
|
||||
return new StringBuilder( ownerEntityTable ).append( "_" )
|
||||
.append(
|
||||
associatedEntityTable != null ?
|
||||
associatedEntityTable :
|
||||
|
|
|
@ -96,8 +96,7 @@ public class DefaultNamingStrategy implements NamingStrategy, Serializable {
|
|||
return tableName;
|
||||
}
|
||||
else {
|
||||
//use of a stringbuffer to workaround a JDK bug
|
||||
return new StringBuffer(ownerEntityTable).append("_")
|
||||
return new StringBuilder(ownerEntityTable).append("_")
|
||||
.append(
|
||||
associatedEntityTable != null ?
|
||||
associatedEntityTable :
|
||||
|
|
|
@ -72,8 +72,7 @@ public class EJB3NamingStrategy implements NamingStrategy, Serializable {
|
|||
return tableName;
|
||||
}
|
||||
else {
|
||||
//use of a stringbuffer to workaround a JDK bug
|
||||
return new StringBuffer( ownerEntityTable ).append( "_" )
|
||||
return new StringBuilder( ownerEntityTable ).append( "_" )
|
||||
.append(
|
||||
associatedEntityTable != null ?
|
||||
associatedEntityTable :
|
||||
|
|
|
@ -110,8 +110,7 @@ public class ImprovedNamingStrategy implements NamingStrategy, Serializable {
|
|||
return tableName;
|
||||
}
|
||||
else {
|
||||
//use of a stringbuffer to workaround a JDK bug
|
||||
return new StringBuffer(ownerEntityTable).append("_")
|
||||
return new StringBuilder(ownerEntityTable).append("_")
|
||||
.append(
|
||||
associatedEntityTable != null ?
|
||||
associatedEntityTable :
|
||||
|
|
|
@ -771,7 +771,7 @@ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
|
|||
}
|
||||
|
||||
/*private String renderOrderByPropertiesSelect() {
|
||||
StringBuffer buf = new StringBuffer(10);
|
||||
StringBuilder buf = new StringBuilder(10);
|
||||
|
||||
//add the columns we are ordering by to the select ID select clause
|
||||
Iterator iter = orderByTokens.iterator();
|
||||
|
|
|
@ -49,7 +49,7 @@ public class WidgetId implements Serializable {
|
|||
|
||||
@Override
|
||||
public String toString( ) {
|
||||
StringBuffer buf = new StringBuffer( "[id:" );
|
||||
StringBuilder buf = new StringBuilder( "[id:" );
|
||||
buf.append( ( this.getCode( ) == null ) ? "null" : this.getCode( ).toString( ) );
|
||||
buf.append( ";code:" );
|
||||
buf.append( ( this.getDivision( ) == null ) ? "null" : this.getDivision( ) );
|
||||
|
|
|
@ -44,6 +44,6 @@ public class Version {
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
return new StringBuffer( major ).append( DOT ).append( minor ).append( DOT ).append( micro ).toString();
|
||||
return new StringBuilder( major ).append( DOT ).append( minor ).append( DOT ).append( micro ).toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,6 @@ public class Version1 {
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
return new StringBuffer( major ).append( DOT ).append( minor ).append( DOT ).append( micro ).toString();
|
||||
return new StringBuilder( major ).append( DOT ).append( minor ).append( DOT ).append( micro ).toString();
|
||||
}
|
||||
}
|
|
@ -44,6 +44,6 @@ public class Version {
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
return new StringBuffer( major ).append( DOT ).append( minor ).append( DOT ).append( micro ).toString();
|
||||
return new StringBuilder( major ).append( DOT ).append( minor ).append( DOT ).append( micro ).toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,8 +63,7 @@ public class AlternativeNamingStrategy extends EJB3NamingStrategy {
|
|||
return tableName;
|
||||
}
|
||||
else {
|
||||
//use of a stringbuffer to workaround a JDK bug
|
||||
return new StringBuffer( ownerEntityTable ).append( "_" )
|
||||
return new StringBuilder( ownerEntityTable ).append( "_" )
|
||||
.append(
|
||||
associatedEntityTable != null ?
|
||||
associatedEntityTable :
|
||||
|
|
|
@ -23,7 +23,7 @@ class GetDimensionFunction extends SDOObjectMethod {
|
|||
}
|
||||
|
||||
public String render(Type firstArgumentType, final List args, final SessionFactoryImplementor factory) {
|
||||
final StringBuffer buf = new StringBuffer();
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
if ( args.isEmpty() ) {
|
||||
throw new IllegalArgumentException(
|
||||
"First Argument in arglist must be object to "
|
||||
|
|
|
@ -23,7 +23,7 @@ class GetGeometryTypeFunction extends SDOObjectMethod {
|
|||
}
|
||||
|
||||
public String render(Type firstArgumentType, final List args, final SessionFactoryImplementor factory) {
|
||||
final StringBuffer buf = new StringBuffer();
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
if ( args.isEmpty() ) {
|
||||
throw new IllegalArgumentException(
|
||||
"First Argument in arglist must be object to which"
|
||||
|
|
|
@ -106,7 +106,7 @@ class OracleSDOSupport implements SpatialDialect, Serializable, WithCustomJPAFil
|
|||
}
|
||||
|
||||
public String getOGCSpatialRelateSQL(String arg1, String arg2, int spatialRelation) {
|
||||
final StringBuffer ogcFunction = new StringBuffer( "MDSYS." );
|
||||
final StringBuilder ogcFunction = new StringBuilder( "MDSYS." );
|
||||
switch ( spatialRelation ) {
|
||||
case SpatialRelation.INTERSECTS:
|
||||
ogcFunction.append( "OGC_INTERSECTS" );
|
||||
|
@ -229,7 +229,7 @@ class OracleSDOSupport implements SpatialDialect, Serializable, WithCustomJPAFil
|
|||
*/
|
||||
@Override
|
||||
public String getSpatialFilterExpression(String columnName) {
|
||||
final StringBuffer buffer = new StringBuffer( "SDO_FILTER(" );
|
||||
final StringBuilder buffer = new StringBuilder( "SDO_FILTER(" );
|
||||
buffer.append( columnName );
|
||||
buffer.append( ",?) = 'TRUE' " );
|
||||
return buffer.toString();
|
||||
|
@ -245,7 +245,7 @@ class OracleSDOSupport implements SpatialDialect, Serializable, WithCustomJPAFil
|
|||
*/
|
||||
@Override
|
||||
public String getSpatialAggregateSQL(String columnName, int aggregation) {
|
||||
final StringBuffer aggregateFunction = new StringBuffer();
|
||||
final StringBuilder aggregateFunction = new StringBuilder();
|
||||
final SpatialAggregate sa = new SpatialAggregate( aggregation );
|
||||
|
||||
if ( sa.getAggregateSyntax() == null ) {
|
||||
|
|
|
@ -175,7 +175,7 @@ class OracleSpatialFunctions extends SpatialFunctionsRegistry {
|
|||
|
||||
static String getOGCSpatialAnalysisSQL(List args, int spatialAnalysisFunction) {
|
||||
boolean[] geomArgs;
|
||||
final StringBuffer ogcFunction = new StringBuffer( "MDSYS." );
|
||||
final StringBuilder ogcFunction = new StringBuilder( "MDSYS." );
|
||||
boolean isGeomReturn = true;
|
||||
switch ( spatialAnalysisFunction ) {
|
||||
case SpatialAnalysis.BUFFER:
|
||||
|
@ -240,7 +240,7 @@ class OracleSpatialFunctions extends SpatialFunctionsRegistry {
|
|||
return ogcFunction.toString();
|
||||
}
|
||||
|
||||
private static StringBuffer wrapInSTGeometry(String geomColumn, StringBuffer toAdd) {
|
||||
private static StringBuilder wrapInSTGeometry(String geomColumn, StringBuilder toAdd) {
|
||||
return toAdd.append( "MDSYS.ST_GEOMETRY(" ).append( geomColumn )
|
||||
.append( ")" );
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ class SDOObjectMethod implements SQLFunction {
|
|||
*/
|
||||
|
||||
public String render(Type firstArgumentType, List args, SessionFactoryImplementor factory) throws QueryException {
|
||||
final StringBuffer buf = new StringBuffer();
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
if ( args.isEmpty() ) {
|
||||
throw new QueryException(
|
||||
"First Argument in arglist must be object to which method is applied"
|
||||
|
|
|
@ -68,7 +68,7 @@ class SDOObjectProperty implements SQLFunction {
|
|||
|
||||
public String render(Type firstArgtype, List args, SessionFactoryImplementor factory)
|
||||
throws QueryException {
|
||||
final StringBuffer buf = new StringBuffer();
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
if ( args.isEmpty() ) {
|
||||
throw new QueryException(
|
||||
"First Argument in arglist must be object of which property is queried"
|
||||
|
|
|
@ -49,7 +49,7 @@ public class OracleSpatialProjection extends SimpleProjection {
|
|||
if ( dialect instanceof SpatialDialect ) {
|
||||
final SpatialDialect seDialect = (SpatialDialect) dialect;
|
||||
|
||||
return new StringBuffer(
|
||||
return new StringBuilder(
|
||||
seDialect.getSpatialAggregateSQL(
|
||||
columns[0], this.aggregate
|
||||
)
|
||||
|
|
|
@ -24,7 +24,7 @@ class SqlServerMethod extends StandardSQLFunction {
|
|||
|
||||
@Override
|
||||
public String render(Type firstArgumentType, List arguments, SessionFactoryImplementor sessionFactory) {
|
||||
final StringBuffer buf = new StringBuffer();
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
if ( arguments.size() < 1 ) {
|
||||
buf.append( getName() ).append( "()" );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue