diff options
Diffstat (limited to 'libjava/classpath/org/omg/IOP/ServiceContextHelper.java')
-rw-r--r-- | libjava/classpath/org/omg/IOP/ServiceContextHelper.java | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/libjava/classpath/org/omg/IOP/ServiceContextHelper.java b/libjava/classpath/org/omg/IOP/ServiceContextHelper.java index 5693a32357a..d6549fa5405 100644 --- a/libjava/classpath/org/omg/IOP/ServiceContextHelper.java +++ b/libjava/classpath/org/omg/IOP/ServiceContextHelper.java @@ -39,6 +39,7 @@ exception statement from your version. */ package org.omg.IOP; import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; import org.omg.CORBA.Any; import org.omg.CORBA.BAD_OPERATION; @@ -57,46 +58,33 @@ import org.omg.CORBA.portable.OutputStream; public abstract class ServiceContextHelper { /** - * The cached typecode value, computed only once. - */ - private static TypeCode typeCode; - - /** - * Create the ServiceContext typecode (structure, - * named "ServiceContext"). - * The typecode states that the structure contains the - * following fields: context_id, context_data. + * Create the ServiceContext typecode (structure, named "ServiceContext"). The + * typecode states that the structure contains the following fields: + * context_id, context_data. */ public static TypeCode type() { - if (typeCode == null) - { - ORB orb = ORB.init(); - StructMember[] members = new StructMember[ 2 ]; + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[2]; - TypeCode field; + TypeCode field; - field = - orb.create_alias_tc("IDL:omg.org/IOP/ServiceId:1.0", "ServiceId", - orb.get_primitive_tc(TCKind.tk_ulong) - ); - members [ 0 ] = new StructMember("context_id", field, null); + field = orb.create_alias_tc("IDL:omg.org/IOP/ServiceId:1.0", "ServiceId", + orb.get_primitive_tc(TCKind.tk_ulong)); + members[0] = new StructMember("context_id", field, null); - field = - orb.create_sequence_tc(0, orb.get_primitive_tc(TCKind.tk_octet)); - members [ 1 ] = new StructMember("context_data", field, null); - typeCode = orb.create_struct_tc(id(), "ServiceContext", members); - } - return typeCode; + field = orb.create_sequence_tc(0, orb.get_primitive_tc(TCKind.tk_octet)); + members[1] = new StructMember("context_data", field, null); + return orb.create_struct_tc(id(), "ServiceContext", members); } /** - * Insert the ServiceContext into the given Any. - * This method uses the ServiceContextHolder. - * - * @param any the Any to insert into. - * @param that the ServiceContext to insert. - */ + * Insert the ServiceContext into the given Any. This method uses the + * ServiceContextHolder. + * + * @param any the Any to insert into. + * @param that the ServiceContext to insert. + */ public static void insert(Any any, ServiceContext that) { any.insert_Streamable(new ServiceContextHolder(that)); |