Skip to content

Commit 362396c

Browse files
committed
Improved logging of ORB initialization
- added toStringMethods - added loggers - ignored exceptions moved to addSuppressed Signed-off-by: David Matějček <david.matejcek@omnifish.ee>
1 parent cd93a62 commit 362396c

10 files changed

Lines changed: 151 additions & 127 deletions

File tree

orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectKeyImpl.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,13 @@ public synchronized byte[] getBytes(org.omg.CORBA.ORB orb)
104104
return array.clone() ;
105105
}
106106

107-
public ServerRequestDispatcher getServerRequestDispatcher()
108-
{
109-
return oktemp.getServerRequestDispatcher( id ) ;
107+
@Override
108+
public ServerRequestDispatcher getServerRequestDispatcher() {
109+
return oktemp.getServerRequestDispatcher(id);
110+
}
111+
112+
@Override
113+
public String toString() {
114+
return getClass().getSimpleName() + "[id=" + id + "]";
110115
}
111116
}
Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/*
2+
* Copyright (c) 2026 Contributors to the Eclipse Foundation
23
* Copyright (c) 1997, 2020 Oracle and/or its affiliates.
34
*
45
* This program and the accompanying materials are made available under the
@@ -35,95 +36,94 @@
3536
/**
3637
* @author Ken Cavanaugh
3738
*/
38-
public class WireObjectKeyTemplate implements ObjectKeyTemplate
39-
{
40-
private ORB orb ;
41-
private static final IORSystemException wrapper =
42-
IORSystemException.self ;
43-
private static ObjectAdapterId NULL_OBJECT_ADAPTER_ID =
44-
new ObjectAdapterIdArray( new String[0] ) ;
39+
public class WireObjectKeyTemplate implements ObjectKeyTemplate {
4540

46-
@Override
47-
public boolean equals( Object obj )
48-
{
49-
if (obj == null) {
50-
return false ;
51-
}
41+
private static final IORSystemException WRAPPER = IORSystemException.self;
42+
private static final ObjectAdapterId NULL_OBJECT_ADAPTER_ID = new ObjectAdapterIdArray(new String[0]);
5243

53-
return obj instanceof WireObjectKeyTemplate ;
54-
}
44+
private ORB orb;
5545

56-
@Override
57-
public int hashCode()
58-
{
59-
return 53 ; // All WireObjectKeyTemplates are the same, so they should
60-
// have the same hashCode.
46+
public WireObjectKeyTemplate(ORB orb) {
47+
this.orb = orb;
6148
}
6249

63-
public WireObjectKeyTemplate( ORB orb )
64-
{
65-
initORB( orb ) ;
50+
@Override
51+
public boolean equals(Object obj) {
52+
if (obj == null) {
53+
return false;
54+
}
55+
return obj instanceof WireObjectKeyTemplate;
6656
}
6757

68-
private void initORB( ORB orb )
69-
{
70-
this.orb = orb ;
58+
@Override
59+
public int hashCode() {
60+
return 53; // All WireObjectKeyTemplates are the same, so they should
61+
// have the same hashCode.
7162
}
7263

73-
public void write( ObjectId id, OutputStream os )
74-
{
75-
byte[] key = id.getId() ;
76-
os.write_octet_array( key, 0, key.length ) ;
64+
@Override
65+
public void write(ObjectId id, OutputStream os) {
66+
byte[] key = id.getId();
67+
os.write_octet_array(key, 0, key.length);
7768
}
7869

79-
public void write( OutputStream os )
80-
{
70+
@Override
71+
public void write(OutputStream os) {
8172
// Does nothing
8273
}
8374

84-
public int getSubcontractId()
85-
{
86-
return ORBConstants.DEFAULT_SCID ;
75+
@Override
76+
public int getSubcontractId() {
77+
return ORBConstants.DEFAULT_SCID;
8778
}
8879

8980
// While it might make sense to throw an exception here, this causes
9081
// problems since we need to check whether unusual object references
91-
// are local or not. It seems that the easiest way to handle this is
82+
// are local or not. It seems that the easiest way to handle this is
9283
// to return an invalid server id.
93-
public int getServerId()
94-
{
95-
return -1 ;
84+
@Override
85+
public int getServerId() {
86+
return -1;
9687
}
9788

98-
public String getORBId()
99-
{
100-
throw wrapper.orbIdNotAvailable() ;
89+
@Override
90+
public String getORBId() {
91+
throw WRAPPER.orbIdNotAvailable();
10192
}
10293

103-
public ObjectAdapterId getObjectAdapterId()
104-
{
105-
return NULL_OBJECT_ADAPTER_ID ;
106-
107-
// throw wrapper.objectAdapterIdNotAvailable() ;
94+
@Override
95+
public ObjectAdapterId getObjectAdapterId() {
96+
return NULL_OBJECT_ADAPTER_ID;
10897
}
10998

99+
110100
// Adapter ID is not available, since our
111101
// ORB did not implement the object carrying this key.
112-
public byte[] getAdapterId()
113-
{
114-
throw wrapper.adapterIdNotAvailable() ;
102+
@Override
103+
public byte[] getAdapterId() {
104+
throw WRAPPER.adapterIdNotAvailable();
105+
}
106+
107+
108+
@Override
109+
public ORBVersion getORBVersion() {
110+
return ORBVersionFactory.getFOREIGN();
115111
}
116112

117-
public ORBVersion getORBVersion()
118-
{
119-
return ORBVersionFactory.getFOREIGN() ;
113+
114+
@Override
115+
public ServerRequestDispatcher getServerRequestDispatcher(ObjectId id) {
116+
byte[] bid = id.getId();
117+
String str = new String(bid);
118+
return orb.getRequestDispatcherRegistry().getServerRequestDispatcher(str);
120119
}
121120

122-
public ServerRequestDispatcher getServerRequestDispatcher( ObjectId id )
123-
{
124-
byte[] bid = id.getId() ;
125-
String str = new String( bid ) ;
126-
return orb.getRequestDispatcherRegistry().getServerRequestDispatcher(
127-
str ) ;
121+
@Override
122+
public String toString() {
123+
return getClass().getSimpleName()
124+
+ "[subcontractId=" + getSubcontractId()
125+
+ " serverId=" + getServerId()
126+
+ " objectadapterId=" + getObjectAdapterId()
127+
+ "]";
128128
}
129129
}

orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryAcceptorImpl.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/*
2+
* Copyright (c) 2026 Contributors to the Eclipse Foundation
23
* Copyright (c) 1997, 2020 Oracle and/or its affiliates.
34
*
45
* This program and the accompanying materials are made available under the
@@ -60,17 +61,6 @@ public boolean initialize()
6061
return true;
6162
}
6263

63-
////////////////////////////////////////////////////
64-
//
65-
// Implementation.
66-
//
67-
68-
@Override
69-
protected String toStringName()
70-
{
71-
return "SocketFactoryAcceptorImpl";
72-
}
73-
7464
// Fix for 6331566.
7565
// This Acceptor must NOT contribute alternate IIOP address components
7666
// to the standard IIOPProfileTemplate,

orbmain/src/main/java/com/sun/corba/ee/impl/misc/ORBUtility.java

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
2-
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2026 Contributors to the Eclipse Foundation
33
* Copyright (c) 2019 Payara Services Ltd.
4+
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
45
*
56
* This program and the accompanying materials are made available under the
67
* terms of the Eclipse Public License v. 2.0 which is available at
@@ -41,6 +42,7 @@
4142
import java.io.IOException ;
4243
import java.io.PrintStream ;
4344
import java.io.Serializable;
45+
import java.lang.System.Logger;
4446
import java.net.SocketAddress ;
4547
import java.nio.ByteBuffer ;
4648
import java.nio.channels.SocketChannel ;
@@ -68,35 +70,35 @@
6870
import org.omg.CORBA.portable.InputStream ;
6971
import org.omg.CORBA.portable.OutputStream ;
7072

73+
import static java.lang.System.Logger.Level.DEBUG;
74+
7175
/**
7276
* Handy class full of static functions that don't belong in util.Utility for pure ORB reasons.
7377
*/
7478
public final class ORBUtility {
79+
private static final Logger LOG = System.getLogger(ORBUtility.class.getName());
80+
7581
/** Utility method for working around leak in SocketChannel.open( SocketAddress )
7682
* method.
7783
* @param sa address to connect to
7884
* @return The opened channel
7985
* @throws java.io.IOException If an I/O error occurs
8086
* @see SocketChannel#connect(java.net.SocketAddress)
8187
*/
82-
public static SocketChannel openSocketChannel( SocketAddress sa )
83-
throws IOException {
84-
85-
SocketChannel sc = SocketChannel.open() ;
86-
88+
public static SocketChannel openSocketChannel(SocketAddress sa) throws IOException {
89+
LOG.log(DEBUG, "openSocketChannel({0})", sa);
90+
SocketChannel sc = SocketChannel.open();
8791
try {
88-
sc.connect( sa ) ;
89-
return sc ;
90-
} catch (RuntimeException | IOException exc ) {
92+
sc.connect(sa);
93+
return sc;
94+
} catch (RuntimeException | IOException exc) {
9195
try {
92-
sc.close() ;
96+
sc.close();
9397
} catch (IOException ioe) {
94-
// Ignore this: close exceptions are useless.
98+
exc.addSuppressed(ioe);
9599
}
96-
97-
throw exc ;
100+
throw exc;
98101
}
99-
100102
}
101103

102104
private static final ThreadLocal<LinkedList<Byte>> encVersionThreadLocal =

orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBConfiguratorImpl.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/*
2+
* Copyright (c) 2026 Contributors to the Eclipse Foundation
23
* Copyright (c) 1997, 2020 Oracle and/or its affiliates.
34
*
45
* This program and the accompanying materials are made available under the
@@ -61,6 +62,7 @@
6162
import com.sun.corba.ee.spi.transport.SocketInfo;
6263
import com.sun.corba.ee.spi.transport.TransportDefault ;
6364

65+
import java.lang.System.Logger;
6466
import java.lang.reflect.InvocationTargetException;
6567
import java.lang.reflect.Method;
6668
import java.security.AccessController ;
@@ -69,7 +71,10 @@
6971
import org.glassfish.pfl.basic.func.NullaryFunction;
7072
import org.glassfish.pfl.dynamic.copyobject.spi.ObjectCopierFactory;
7173

74+
import static java.lang.System.Logger.Level.TRACE;
75+
7276
public class ORBConfiguratorImpl implements ORBConfigurator {
77+
private static final Logger LOG = System.getLogger(ORBConfiguratorImpl.class.getName());
7378
private static final ORBUtilSystemException wrapper =
7479
ORBUtilSystemException.self ;
7580

@@ -99,8 +104,10 @@ public PropertyParser makeParser()
99104
}
100105
}
101106

102-
public void configure( DataCollector collector, ORB orb )
107+
@Override
108+
public void configure( DataCollector collector, ORB orb )
103109
{
110+
LOG.log(TRACE, "configure(collector, orb)");
104111
ORB theOrb = orb ;
105112

106113
initObjectCopiers( theOrb ) ;

0 commit comments

Comments
 (0)