Skip to content
Permalink
Browse files
Merge branch 'perf_helper_lookup' into 'ibm-trunk'
Avoid BoxedValueHelper lookups where possible

See merge request !26
  • Loading branch information
ngmr committed Apr 17, 2015
2 parents 5b8f2a3 + ec93968 commit 2635b60539ab16ff37f573aab63b611b1ace0c73
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 28 deletions.
@@ -39,7 +39,7 @@ private static byte[] stringToKey(String keyStr) {
throw new org.omg.CORBA.BAD_PARAM(
MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart)
+ ": invalid character in key",
+ ": invalid character in key, char value = 0x" + Integer.toHexString(ch),
org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
@@ -80,7 +80,7 @@ private org.omg.CORBA.Object parse_addresses(String str, int startIdx,
throw new org.omg.CORBA.BAD_PARAM(
MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart)
+ ": invalid initial reference token",
+ ": invalid initial reference token \"" + keyStr + "\"",
org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
@@ -17,10 +17,17 @@

package org.apache.yoko.orb.OB;

import static org.apache.yoko.orb.OB.MinorCodes.MinorOther;
import static org.omg.CORBA.CompletionStatus.COMPLETED_NO;

import java.io.PrintWriter;
import java.io.StringWriter;

import org.apache.yoko.orb.OB.CorbalocURLScheme;
import org.apache.yoko.orb.OB.CorbalocURLSchemeHelper;
import org.apache.yoko.orb.OB.URLRegistry;
import org.apache.yoko.orb.OB.URLScheme;
import org.omg.CORBA.BAD_PARAM;

public class CorbanameURLScheme_impl extends org.omg.CORBA.LocalObject
implements URLScheme {
@@ -115,6 +122,7 @@ else if ((slash != -1 && fragmentStart == -1)
// Make a DII invocation on the Naming Service to resolve the
// specified context
//
Exception failureCause;
try {
//
// Create typecodes for Name and NameComponent
@@ -144,7 +152,7 @@ else if ((slash != -1 && fragmentStart == -1)
throw new org.omg.CORBA.BAD_PARAM(
MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart)
+ ": invalid stringified name",
+ ": invalid stringified name \"" + fragment + "\"",
org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);

@@ -209,18 +217,22 @@ else if ((slash != -1 && fragmentStart == -1)
//
// Return the result if there was no exception
//
if (request.env().exception() == null)
failureCause = request.env().exception();
if (failureCause == null)
return request.return_value().extract_Object();

} catch (org.omg.CORBA.SystemException ex) {
failureCause = ex;
// Fall through
} catch (org.omg.CORBA.UserException ex) {
failureCause = ex;
// Fall through
}

throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorOther)
+ ": corbaname evaluation error", org.apache.yoko.orb.OB.MinorCodes.MinorOther,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
final BAD_PARAM bp = new BAD_PARAM(MinorCodes.describeBadParam(MinorOther)
+ ": corbaname evaluation error:" + failureCause.getMessage(), MinorOther,
COMPLETED_NO);
throw (BAD_PARAM)bp.initCause(failureCause);
}

public void destroy() {
@@ -72,7 +72,7 @@ public org.omg.CORBA.Object parse_url(String url) {
//
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart)
+ ": invalid IOR", org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart,
+ ": invalid IOR \"" + url + "\"", org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
}
@@ -23,7 +23,9 @@

import org.apache.yoko.orb.CORBA.ORB;
import org.apache.yoko.osgi.ProviderLocator;
import org.omg.CORBA.WStringValueHelper;
import org.omg.CORBA.portable.BoxedValueHelper;
import org.omg.CORBA.portable.IDLEntity;

final public class ValueWriter {
//
@@ -183,7 +185,14 @@ private BoxedValueHelper getHelper(java.io.Serializable value,
BoxedValueHelper result = null;

Class helperClass = null;
final Class<?> valueClass = value.getClass();

//Short-cuts
if (String.class == valueClass) {
return new WStringValueHelper();
} else if (!!!IDLEntity.class.isAssignableFrom(valueClass)) {
return null;
}
//
// First try constructing a class name based on the class of
// the value. This will only work for primitive types, because
@@ -84,7 +84,7 @@ else if (name.equals("type"))

} catch (InvocationTargetException ex) {
throw new RuntimeException(
"cannot initialize: " + ex, ex);
"cannot initialize: " + ex.getCause(), ex.getCause());

} catch (IllegalAccessException ex) {
throw new RuntimeException(
@@ -143,7 +143,7 @@ public Object readValue(org.omg.CORBA.portable.InputStream in) {
try {
return _read_method.invoke(null, new Object[] { in });
} catch (InvocationTargetException ex) {
throw (org.omg.CORBA.MARSHAL)new org.omg.CORBA.MARSHAL(ex.getMessage()).initCause(ex);
throw (org.omg.CORBA.MARSHAL)new org.omg.CORBA.MARSHAL(""+ex.getCause()).initCause(ex.getCause());
} catch (IllegalAccessException ex) {
throw (org.omg.CORBA.MARSHAL)new org.omg.CORBA.MARSHAL(ex.getMessage()).initCause(ex);
}
@@ -178,7 +178,7 @@ public void writeValue(org.omg.CORBA.portable.OutputStream out, java.io.Serializ
try {
_write_method.invoke(null, new Object[] { out, val });
} catch (InvocationTargetException ex) {
throw (org.omg.CORBA.MARSHAL)new org.omg.CORBA.MARSHAL(ex.getMessage()).initCause(ex);
throw (org.omg.CORBA.MARSHAL)new org.omg.CORBA.MARSHAL(""+ ex.getCause()).initCause(ex.getCause());
} catch (IllegalAccessException ex) {
throw (org.omg.CORBA.MARSHAL)new org.omg.CORBA.MARSHAL(ex.getMessage()).initCause(ex);
}
@@ -191,7 +191,7 @@ org.omg.CORBA.TypeCode getTypeCode() {
_type_code = (org.omg.CORBA.TypeCode) _type_method.invoke(null,
new Object[0]);
} catch (InvocationTargetException ex) {
throw (org.omg.CORBA.MARSHAL)new org.omg.CORBA.MARSHAL(ex.getMessage()).initCause(ex);
throw (org.omg.CORBA.MARSHAL)new org.omg.CORBA.MARSHAL(""+ex.getCause()).initCause(ex.getCause());
} catch (IllegalAccessException ex) {
throw (org.omg.CORBA.MARSHAL)new org.omg.CORBA.MARSHAL(ex.getMessage()).initCause(ex);
}
@@ -284,7 +284,7 @@ static javax.rmi.CORBA.Stub createRMIStub(RMIState state, Class type)
"internal problem: cannot instantiate stub", ex);
} catch (InvocationTargetException ex) {
throw new RuntimeException(
"internal problem: cannot instantiate stub", ex);
"internal problem: cannot instantiate stub", ex.getCause());
} catch (IllegalAccessException ex) {
throw new RuntimeException(
"internal problem: cannot instantiate stub", ex);
@@ -127,7 +127,7 @@ Object invoke_method(java.lang.reflect.Method m, Object[] args)
try {
return m.invoke(_target, args);
} catch (java.lang.reflect.InvocationTargetException ex) {
logger.log(Level.FINER, "Error invoking local method", ex);
logger.log(Level.FINER, "Error invoking local method", ex.getCause());
throw ex.getTargetException();
}
} else {
@@ -266,7 +266,7 @@ public Stub getStaticStub(String codebase, Class type) {
+ ex.getMessage(), ex);
} catch (InvocationTargetException ex) {
logger.log(Level.FINE, "cannot instantiate stub class for " + type + " :: "
+ ex.getMessage(), ex);
+ ex.getCause(), ex.getCause());
}

return null;
@@ -43,6 +43,7 @@
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.ValueMember;
import org.omg.CORBA.ValueDefPackage.FullValueDescription;
import org.omg.CORBA.portable.UnknownException;
import org.omg.SendingContext.CodeBase;
import org.omg.SendingContext.CodeBaseHelper;

@@ -521,8 +522,8 @@ public java.io.Serializable writeReplace(java.io.Serializable val) {
throw (MARSHAL)new MARSHAL(ex.getMessage()).initCause(ex);

} catch (InvocationTargetException ex) {
throw new org.omg.CORBA.portable.UnknownException(ex
.getTargetException());
throw (UnknownException)new UnknownException(ex
.getTargetException()).initCause(ex.getTargetException());
}

}
@@ -543,8 +544,8 @@ public java.io.Serializable readResolve(java.io.Serializable val) {
throw (MARSHAL)new MARSHAL(ex.getMessage()).initCause(ex);

} catch (InvocationTargetException ex) {
throw new org.omg.CORBA.portable.UnknownException(ex
.getTargetException());
throw (UnknownException)new UnknownException(ex
.getTargetException()).initCause(ex.getTargetException());
}

}
@@ -615,8 +616,8 @@ protected void writeValue(ObjectWriter writer, java.io.Serializable val)

} catch (InvocationTargetException ex) {

throw new org.omg.CORBA.portable.UnknownException(ex
.getTargetException());
throw (UnknownException)new UnknownException(ex
.getTargetException()).initCause(ex.getTargetException());
}

} else {
@@ -642,8 +643,8 @@ public java.io.Serializable createBlankInstance() {
throw (MARSHAL)new MARSHAL(ex.getMessage()).initCause(ex);

} catch (InvocationTargetException ex) {
throw new org.omg.CORBA.portable.UnknownException(ex
.getTargetException());
throw (UnknownException)new UnknownException(ex
.getTargetException()).initCause(ex.getTargetException());

} catch (NullPointerException ex) {
logger.log(Level.WARNING,
@@ -859,8 +860,8 @@ protected void readValue(ObjectReader reader, java.io.Serializable value)
} catch (IllegalArgumentException ex) {
throw (MARSHAL)new MARSHAL(ex.getMessage()).initCause(ex);
} catch (InvocationTargetException ex) {
throw new org.omg.CORBA.portable.UnknownException(ex
.getTargetException());
throw (UnknownException)new UnknownException(ex
.getTargetException()).initCause(ex.getTargetException());
}

} else {
@@ -246,7 +246,7 @@ public Object run() {
} catch (InstantiationException ex) {
logger.log(Level.WARNING, "", ex);
} catch (InvocationTargetException ex) {
logger.log(Level.WARNING, "", ex);
logger.log(Level.WARNING, "", ex.getCause());
} catch (IllegalAccessException ex) {
logger.log(Level.WARNING, "", ex);
}
@@ -21,7 +21,7 @@ public class UnknownException extends org.omg.CORBA.SystemException {
public Throwable originalEx;

public UnknownException(Throwable ex) {
super("", 0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
super("originalEx: " + ex, 0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
originalEx = ex;
}
}

0 comments on commit 2635b60

Please sign in to comment.