下面列出了怎么用org.omg.CORBA.CompletionStatus的API类实例代码及写法,或者点击链接到github查看源代码。
public INTERNAL errorSetDoubleField( CompletionStatus cs, Throwable t, Object arg0, Object arg1, Object arg2) {
INTERNAL exc = new INTERNAL( ERROR_SET_DOUBLE_FIELD, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.WARNING )) {
Object[] parameters = new Object[3] ;
parameters[0] = arg0 ;
parameters[1] = arg1 ;
parameters[2] = arg2 ;
doLog( Level.WARNING, "UTIL.errorSetDoubleField",
parameters, UtilSystemException.class, exc ) ;
}
return exc ;
}
public INTERNAL errorSetIntField( CompletionStatus cs, Throwable t, Object arg0, Object arg1, Object arg2) {
INTERNAL exc = new INTERNAL( ERROR_SET_INT_FIELD, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.WARNING )) {
Object[] parameters = new Object[3] ;
parameters[0] = arg0 ;
parameters[1] = arg1 ;
parameters[2] = arg2 ;
doLog( Level.WARNING, "UTIL.errorSetIntField",
parameters, UtilSystemException.class, exc ) ;
}
return exc ;
}
public INTERNAL poaInternalGetServantError( CompletionStatus cs, Throwable t ) {
INTERNAL exc = new INTERNAL( POA_INTERNAL_GET_SERVANT_ERROR, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.WARNING )) {
Object[] parameters = null ;
doLog( Level.WARNING, "POA.poaInternalGetServantError",
parameters, POASystemException.class, exc ) ;
}
return exc ;
}
public INTERNAL noProfilesInIor( CompletionStatus cs, Throwable t ) {
INTERNAL exc = new INTERNAL( NO_PROFILES_IN_IOR, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.WARNING )) {
Object[] parameters = null ;
doLog( Level.WARNING, "POA.noProfilesInIor",
parameters, POASystemException.class, exc ) ;
}
return exc ;
}
protected SystemException convertThrowableToSystemException(
Throwable throwable,
CompletionStatus completionStatus)
{
if (throwable instanceof SystemException) {
return (SystemException)throwable;
}
if (throwable instanceof RequestCanceledException) {
// Reporting an exception response causes the
// poa current stack, the interceptor stacks, etc.
// to be balanced. It also notifies interceptors
// that the request was cancelled.
return wrapper.requestCanceled( throwable ) ;
}
// NOTE: We do not trap ThreadDeath above Throwable.
// There is no reason to stop the thread. It is
// just a worker thread. The ORB never throws
// ThreadDeath. Client code may (e.g., in ServantManagers,
// interceptors, or servants) but that should not
// effect the ORB threads. So it is just handled
// generically.
//
// Last resort.
// If user code throws a non-SystemException report it generically.
//
return wrapper.runtimeexception( CompletionStatus.COMPLETED_MAYBE, throwable ) ;
}
public OBJECT_NOT_EXIST adapterDestroyed( CompletionStatus cs, Throwable t ) {
OBJECT_NOT_EXIST exc = new OBJECT_NOT_EXIST( ADAPTER_DESTROYED, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.WARNING )) {
Object[] parameters = null ;
doLog( Level.WARNING, "POA.adapterDestroyed",
parameters, POASystemException.class, exc ) ;
}
return exc ;
}
public NO_RESOURCES noConnectionPriority( CompletionStatus cs, Throwable t ) {
NO_RESOURCES exc = new NO_RESOURCES( NO_CONNECTION_PRIORITY, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.WARNING )) {
Object[] parameters = null ;
doLog( Level.WARNING, "OMG.noConnectionPriority",
parameters, OMGSystemException.class, exc ) ;
}
return exc ;
}
public INTERNAL cantCloneTemplate( CompletionStatus cs, Throwable t ) {
INTERNAL exc = new INTERNAL( CANT_CLONE_TEMPLATE, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.WARNING )) {
Object[] parameters = null ;
doLog( Level.WARNING, "POA.cantCloneTemplate",
parameters, POASystemException.class, exc ) ;
}
return exc ;
}
public BAD_PARAM xaCallInval( CompletionStatus cs, Throwable t ) {
BAD_PARAM exc = new BAD_PARAM( XA_CALL_INVAL, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.WARNING )) {
Object[] parameters = null ;
doLog( Level.WARNING, "OMG.xaCallInval",
parameters, OMGSystemException.class, exc ) ;
}
return exc ;
}
public void cleanupClientPIRequest() {
if( !hasClientInterceptors ) return;
if( !isClientPIEnabledForThisThread() ) return;
ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
RetryType rt = info.getRetryRequest() ;
// fix for 6763340
if (!rt.equals( RetryType.BEFORE_RESPONSE )) {
// If the replyStatus has not yet been set, this is an indication
// that the ORB threw an exception before we had a chance to
// invoke the client interceptor ending points.
//
// _REVISIT_ We cannot handle any exceptions or ForwardRequests
// flagged by the ending points here because there is no way
// to gracefully handle this in any of the calling code.
// This is a rare corner case, so we will ignore this for now.
short replyStatus = info.getReplyStatus();
if (replyStatus == info.UNINITIALIZED ) {
invokeClientPIEndingPoint( ReplyMessage.SYSTEM_EXCEPTION,
wrapper.unknownRequestInvoke(
CompletionStatus.COMPLETED_MAYBE ) ) ;
}
}
// Decrement entry count, and if it is zero, pop it from the stack.
info.decrementEntryCount();
// fix for 6763340, and probably other cases (non-recursive retry)
if (info.getEntryCount() == 0 && !info.getRetryRequest().isRetry()) {
// RequestInfoStack<ClientRequestInfoImpl> infoStack =
// threadLocalClientRequestInfoStack.get();
RequestInfoStack infoStack =
(RequestInfoStack)threadLocalClientRequestInfoStack.get();
infoStack.pop();
printPop();
}
}
private static void AreFragmentsAllowed(byte major, byte minor, byte flag,
byte msgType) {
if ( (major == 0x01) && (minor == 0x00) ) { // 1.0
if (msgType == GIOPFragment) {
throw wrapper.fragmentationDisallowed(
CompletionStatus.COMPLETED_MAYBE);
}
}
if ( (flag & MORE_FRAGMENTS_BIT) == MORE_FRAGMENTS_BIT ) {
switch (msgType) {
case GIOPCancelRequest :
case GIOPCloseConnection :
case GIOPMessageError :
throw wrapper.fragmentationDisallowed(
CompletionStatus.COMPLETED_MAYBE);
case GIOPLocateRequest :
case GIOPLocateReply :
if ( (major == 0x01) && (minor == 0x01) ) { // 1.1
throw wrapper.fragmentationDisallowed(
CompletionStatus.COMPLETED_MAYBE);
}
break;
}
}
}
public INITIALIZE bootstrapError( CompletionStatus cs, Throwable t ) {
INITIALIZE exc = new INITIALIZE( BOOTSTRAP_ERROR, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.WARNING )) {
Object[] parameters = null ;
doLog( Level.WARNING, "POA.bootstrapError",
parameters, POASystemException.class, exc ) ;
}
return exc ;
}
/**
* Get the helper for an IDLValue
*
* Throws MARSHAL exception if no helper found.
*/
public static BoxedValueHelper getHelper(Class clazz, String codebase,
String repId)
{
String className = null;
if (clazz != null) {
className = clazz.getName();
if (codebase == null)
codebase = Util.getCodebase(clazz);
} else {
if (repId != null)
className = RepositoryId.cache.getId(repId).getClassName();
if (className == null) // no repId or unrecognized repId
throw wrapper.unableLocateValueHelper(
CompletionStatus.COMPLETED_MAYBE);
}
try {
ClassLoader clazzLoader =
(clazz == null ? null : clazz.getClassLoader());
Class helperClass =
loadClassForClass(className+"Helper", codebase, clazzLoader,
clazz, clazzLoader);
return (BoxedValueHelper)helperClass.newInstance();
} catch (ClassNotFoundException cnfe) {
throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE,
cnfe );
} catch (IllegalAccessException iae) {
throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE,
iae );
} catch (InstantiationException ie) {
throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE,
ie );
} catch (ClassCastException cce) {
throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE,
cce );
}
}
public BAD_INV_ORDER invalidPiCall1( CompletionStatus cs, Throwable t ) {
BAD_INV_ORDER exc = new BAD_INV_ORDER( INVALID_PI_CALL1, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.FINE )) {
Object[] parameters = null ;
doLog( Level.FINE, "OMG.invalidPiCall1",
parameters, OMGSystemException.class, exc ) ;
}
return exc ;
}
public PresentationManager.StubFactory createStubFactory(
String className, boolean isIDLStub, String remoteCodeBase,
Class expectedClass, ClassLoader classLoader)
{
Class cls = null ;
try {
cls = Util.loadClass( className, remoteCodeBase, classLoader ) ;
} catch (ClassNotFoundException exc) {
throw wrapper.classNotFound3(
CompletionStatus.COMPLETED_MAYBE, exc, className ) ;
}
PresentationManager pm = ORB.getPresentationManager() ;
if (IDLEntity.class.isAssignableFrom( cls ) &&
!Remote.class.isAssignableFrom( cls )) {
// IDL stubs must always use static factories.
PresentationManager.StubFactoryFactory sff =
pm.getStubFactoryFactory( false ) ;
PresentationManager.StubFactory sf =
sff.createStubFactory( className, true, remoteCodeBase,
expectedClass, classLoader ) ;
return sf ;
} else {
PresentationManager.ClassData classData = pm.getClassData( cls ) ;
return makeDynamicStubFactory( pm, classData, classLoader ) ;
}
}
public UNKNOWN unknownUserException( CompletionStatus cs, Throwable t ) {
UNKNOWN exc = new UNKNOWN( UNKNOWN_USER_EXCEPTION, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.FINE )) {
Object[] parameters = null ;
doLog( Level.FINE, "OMG.unknownUserException",
parameters, OMGSystemException.class, exc ) ;
}
return exc ;
}
public TRANSIENT poaDestroyed( CompletionStatus cs, Throwable t ) {
TRANSIENT exc = new TRANSIENT( POA_DESTROYED, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.WARNING )) {
Object[] parameters = null ;
doLog( Level.WARNING, "OMG.poaDestroyed",
parameters, OMGSystemException.class, exc ) ;
}
return exc ;
}
public INTERNAL pmfCreateRetain( CompletionStatus cs, Throwable t ) {
INTERNAL exc = new INTERNAL( PMF_CREATE_RETAIN, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.WARNING )) {
Object[] parameters = null ;
doLog( Level.WARNING, "POA.pmfCreateRetain",
parameters, POASystemException.class, exc ) ;
}
return exc ;
}
public INTERNAL exceptionInContexts( CompletionStatus cs, Throwable t ) {
INTERNAL exc = new INTERNAL( EXCEPTION_IN_CONTEXTS, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.WARNING )) {
Object[] parameters = null ;
doLog( Level.WARNING, "INTERCEPTORS.exceptionInContexts",
parameters, InterceptorsSystemException.class, exc ) ;
}
return exc ;
}
public OBJ_ADAPTER noContext( CompletionStatus cs, Throwable t ) {
OBJ_ADAPTER exc = new OBJ_ADAPTER( NO_CONTEXT, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.FINE )) {
Object[] parameters = null ;
doLog( Level.FINE, "POA.noContext",
parameters, POASystemException.class, exc ) ;
}
return exc ;
}
public MARSHAL unsupportedFormatVersion( CompletionStatus cs, Throwable t ) {
MARSHAL exc = new MARSHAL( UNSUPPORTED_FORMAT_VERSION, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.WARNING )) {
Object[] parameters = null ;
doLog( Level.WARNING, "OMG.unsupportedFormatVersion",
parameters, OMGSystemException.class, exc ) ;
}
return exc ;
}
public BAD_PARAM unionBadDiscriminator( CompletionStatus cs, Throwable t ) {
BAD_PARAM exc = new BAD_PARAM( UNION_BAD_DISCRIMINATOR, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.WARNING )) {
Object[] parameters = null ;
doLog( Level.WARNING, "OMG.unionBadDiscriminator",
parameters, OMGSystemException.class, exc ) ;
}
return exc ;
}
public MARSHAL rmiiiopOptionalDataIncompatible3( CompletionStatus cs, Throwable t ) {
MARSHAL exc = new MARSHAL( RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE3, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.FINE )) {
Object[] parameters = null ;
doLog( Level.FINE, "OMG.rmiiiopOptionalDataIncompatible3",
parameters, OMGSystemException.class, exc ) ;
}
return exc ;
}
public void cleanupClientPIRequest() {
if( !hasClientInterceptors ) return;
if( !isClientPIEnabledForThisThread() ) return;
ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
RetryType rt = info.getRetryRequest() ;
// fix for 6763340
if (!rt.equals( RetryType.BEFORE_RESPONSE )) {
// If the replyStatus has not yet been set, this is an indication
// that the ORB threw an exception before we had a chance to
// invoke the client interceptor ending points.
//
// _REVISIT_ We cannot handle any exceptions or ForwardRequests
// flagged by the ending points here because there is no way
// to gracefully handle this in any of the calling code.
// This is a rare corner case, so we will ignore this for now.
short replyStatus = info.getReplyStatus();
if (replyStatus == info.UNINITIALIZED ) {
invokeClientPIEndingPoint( ReplyMessage.SYSTEM_EXCEPTION,
wrapper.unknownRequestInvoke(
CompletionStatus.COMPLETED_MAYBE ) ) ;
}
}
// Decrement entry count, and if it is zero, pop it from the stack.
info.decrementEntryCount();
// fix for 6763340, and probably other cases (non-recursive retry)
if (info.getEntryCount() == 0 && !info.getRetryRequest().isRetry()) {
// RequestInfoStack<ClientRequestInfoImpl> infoStack =
// threadLocalClientRequestInfoStack.get();
RequestInfoStack infoStack =
(RequestInfoStack)threadLocalClientRequestInfoStack.get();
infoStack.pop();
printPop();
}
}
protected SystemException convertThrowableToSystemException(
Throwable throwable,
CompletionStatus completionStatus)
{
if (throwable instanceof SystemException) {
return (SystemException)throwable;
}
if (throwable instanceof RequestCanceledException) {
// Reporting an exception response causes the
// poa current stack, the interceptor stacks, etc.
// to be balanced. It also notifies interceptors
// that the request was cancelled.
return wrapper.requestCanceled( throwable ) ;
}
// NOTE: We do not trap ThreadDeath above Throwable.
// There is no reason to stop the thread. It is
// just a worker thread. The ORB never throws
// ThreadDeath. Client code may (e.g., in ServantManagers,
// interceptors, or servants) but that should not
// effect the ORB threads. So it is just handled
// generically.
//
// Last resort.
// If user code throws a non-SystemException report it generically.
//
return wrapper.runtimeexception( CompletionStatus.COMPLETED_MAYBE, throwable ) ;
}
public OBJ_ADAPTER badPolicyIncarnate( CompletionStatus cs, Throwable t ) {
OBJ_ADAPTER exc = new OBJ_ADAPTER( BAD_POLICY_INCARNATE, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.WARNING )) {
Object[] parameters = null ;
doLog( Level.WARNING, "OMG.badPolicyIncarnate",
parameters, OMGSystemException.class, exc ) ;
}
return exc ;
}
public final void write_float_array(float[]value, int offset, int length) {
if ( value == null )
throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
// This will only have an effect if we're already chunking
handleSpecialChunkBegin(computeAlignment(4) + (length * 4));
for (int i = 0; i < length; i++)
write_float(value[offset + i]);
// This will only have an effect if we're already chunking
handleSpecialChunkEnd();
}
public BAD_PARAM badTransactionContext( CompletionStatus cs, Throwable t ) {
BAD_PARAM exc = new BAD_PARAM( BAD_TRANSACTION_CONTEXT, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.WARNING )) {
Object[] parameters = null ;
doLog( Level.WARNING, "POA.badTransactionContext",
parameters, POASystemException.class, exc ) ;
}
return exc ;
}
public BAD_OPERATION operationUnknownToTarget( CompletionStatus cs, Throwable t ) {
BAD_OPERATION exc = new BAD_OPERATION( OPERATION_UNKNOWN_TO_TARGET, cs ) ;
if (t != null)
exc.initCause( t ) ;
if (logger.isLoggable( Level.WARNING )) {
Object[] parameters = null ;
doLog( Level.WARNING, "OMG.operationUnknownToTarget",
parameters, OMGSystemException.class, exc ) ;
}
return exc ;
}
public char read_wchar() {
// Don't allow transmission of wchar/wstring data with
// foreign ORBs since it's against the spec.
if (ORBUtility.isForeignORB((ORB)orb)) {
throw wrapper.wcharDataInGiop10( CompletionStatus.COMPLETED_MAYBE);
}
// If we're talking to one of our legacy ORBs, do what
// they did:
int b1, b2;
alignAndCheck(2, 2);
if (littleEndian) {
b2 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF;
bbwi.position(bbwi.position() + 1);
b1 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF;
bbwi.position(bbwi.position() + 1);
} else {
b1 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF;
bbwi.position(bbwi.position() + 1);
b2 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF;
bbwi.position(bbwi.position() + 1);
}
return (char)((b1 << 8) + (b2 << 0));
}