Skip to content

Commit 6beae34

Browse files
committed
Bug 37155830 - [36530062->24.09.1] Add backwards compatibility support to looking up undocumented system properties configured with prefix of fully qualified class name (ce-main->ce-24.09)
Remote remote.full on coherence-ce/release/coherence-ce-v24.09 success, changes 111925, synced @111926, job.9.20241014220414.8130 [git-p4: depot-paths = "//dev/coherence-ce/release/coherence-ce-v24.09/": change = 111932]
1 parent 5b1bcb6 commit 6beae34

File tree

16 files changed

+196
-120
lines changed

16 files changed

+196
-120
lines changed

prj/coherence-core/src/main/java/com/oracle/coherence/common/base/SingleWaiterCooperativeNotifier.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
/*
2-
* Copyright (c) 2000, 2020, Oracle and/or its affiliates.
2+
* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
33
*
44
* Licensed under the Universal Permissive License v 1.0 as shown at
5-
* http://oss.oracle.com/licenses/upl.
5+
* https://oss.oracle.com/licenses/upl.
66
*/
77
package com.oracle.coherence.common.base;
88

99
import com.oracle.coherence.common.collections.ConcurrentLinkedQueue;
1010

11+
import com.tangosol.coherence.config.Config;
12+
1113
import java.util.Queue;
1214
import java.util.concurrent.locks.LockSupport;
1315

@@ -153,6 +155,6 @@ protected void consumeSignal()
153155
/**
154156
* The number of threads to awake upon a static flush call.
155157
*/
156-
private static final int FLUSH_AWAKE_COUNT = Integer.parseInt(
157-
System.getProperty(SingleWaiterCooperativeNotifier.class.getName() + ".wakeOnFlush", "1"));
158+
private static final int FLUSH_AWAKE_COUNT = Config.getInteger(
159+
SingleWaiterCooperativeNotifier.class.getName() + ".wakeOnFlush", 1);
158160
}

prj/coherence-core/src/main/java/com/oracle/coherence/common/internal/Platform.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
/*
2-
* Copyright (c) 2000, 2020, Oracle and/or its affiliates.
2+
* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
33
*
44
* Licensed under the Universal Permissive License v 1.0 as shown at
5-
* http://oss.oracle.com/licenses/upl.
5+
* https://oss.oracle.com/licenses/upl.
66
*/
77
package com.oracle.coherence.common.internal;
88

99
import com.sun.management.OperatingSystemMXBean;
1010

11+
import com.tangosol.coherence.config.Config;
12+
1113
import java.lang.management.ManagementFactory;
1214

1315
import java.io.File;
@@ -56,8 +58,7 @@ private Platform()
5658
int cProcFair = Math.max(1, (int) Math.ceil((double) Runtime.getRuntime().availableProcessors() *
5759
Math.min(1.0, (double) Runtime.getRuntime().maxMemory() / (double) getTotalPhysicalMemorySize())));
5860

59-
f_cProcFair = Integer.parseInt(System.getProperty(Platform.class.getName() + ".fairShareProcessors",
60-
String.valueOf(cProcFair)));
61+
f_cProcFair = Config.getInteger(Platform.class.getName() + ".fairShareProcessors", cProcFair);
6162
}
6263

6364
/**

prj/coherence-core/src/main/java/com/oracle/coherence/common/internal/io/CheckedBufferManager.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* Copyright (c) 2000, 2020, Oracle and/or its affiliates.
2+
* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
33
*
44
* Licensed under the Universal Permissive License v 1.0 as shown at
5-
* http://oss.oracle.com/licenses/upl.
5+
* https://oss.oracle.com/licenses/upl.
66
*/
77
package com.oracle.coherence.common.internal.io;
88

@@ -13,6 +13,8 @@
1313
import com.oracle.coherence.common.io.BufferManagers;
1414
import com.oracle.coherence.common.util.MemorySize;
1515

16+
import com.tangosol.coherence.config.Config;
17+
1618
import java.nio.ByteBuffer;
1719
import java.util.Arrays;
1820
import java.util.HashMap;
@@ -527,20 +529,19 @@ record = new LeakSuspect();
527529
/**
528530
* The interval at which to log warning messages.
529531
*/
530-
protected static final long BYTE_WARNING_INTERVAL = new MemorySize(System.getProperty(
532+
protected static final long BYTE_WARNING_INTERVAL = new MemorySize(Config.getProperty(
531533
CheckedBufferManager.class.getName() + ".limit", String.valueOf(Runtime.getRuntime().maxMemory() / 10)))
532534
.getByteCount();
533535

534536
/**
535-
* The interval at which to log warning messages.
537+
* When {@code true}, generate a heap dump when there is a warning.
536538
*/
537-
protected static final boolean DUMP_ON_WARNING = Boolean.getBoolean(CheckedBufferManager.class.getName() + ".dump");
539+
protected static final boolean DUMP_ON_WARNING = Config.getBoolean(CheckedBufferManager.class.getName() + ".dump");
538540

539541
/**
540542
* The ratio at which acquisitions are sampled.
541543
*/
542-
protected static final int SAMPLING_RATIO = Integer.parseInt(System.getProperty(
543-
CheckedBufferManager.class.getName() + ".samplingRatio", "1"));
544+
protected static final int SAMPLING_RATIO = Config.getInteger(CheckedBufferManager.class.getName() + ".samplingRatio", 1);
544545

545546
// ----- data members -------------------------------------------
546547

prj/coherence-core/src/main/java/com/oracle/coherence/common/internal/io/SegmentedBufferManager.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* Copyright (c) 2000, 2020, Oracle and/or its affiliates.
2+
* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
33
*
44
* Licensed under the Universal Permissive License v 1.0 as shown at
5-
* http://oss.oracle.com/licenses/upl.
5+
* https://oss.oracle.com/licenses/upl.
66
*/
77
package com.oracle.coherence.common.internal.io;
88

@@ -16,6 +16,8 @@
1616
import com.oracle.coherence.common.util.Duration;
1717
import com.oracle.coherence.common.util.MemorySize;
1818

19+
import com.tangosol.coherence.config.Config;
20+
1921
import java.nio.ByteOrder;
2022
import java.util.logging.Logger;
2123
import java.util.logging.Level;
@@ -1169,8 +1171,8 @@ public interface BufferAllocator
11691171
* reevaluated, since it is possible that they have no activity that
11701172
* would cause them to reevaluate on their own.
11711173
*/
1172-
protected static final long CLEANUP_FREQUENCY_MILLIS = new Duration(System.getProperty(
1173-
SegmentedBufferManager.class.getName() + ".cleanup.frequency", "1s")).as(Duration.Magnitude.MILLI);
1174+
protected static final long CLEANUP_FREQUENCY_MILLIS = Config.getDuration(SegmentedBufferManager.class.getName() + ".cleanup.frequency",
1175+
new Duration(1, Duration.Magnitude.SECOND)).as(Duration.Magnitude.MILLI);
11741176

11751177
/**
11761178
* The logger.

prj/coherence-core/src/main/java/com/oracle/coherence/common/internal/net/MultiplexedSocketProvider.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* Copyright (c) 2000, 2021, Oracle and/or its affiliates.
2+
* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
33
*
44
* Licensed under the Universal Permissive License v 1.0 as shown at
5-
* http://oss.oracle.com/licenses/upl.
5+
* https://oss.oracle.com/licenses/upl.
66
*/
77
package com.oracle.coherence.common.internal.net;
88

@@ -20,6 +20,8 @@
2020
import com.oracle.coherence.common.net.TcpSocketProvider;
2121
import com.oracle.coherence.common.util.Duration;
2222

23+
import com.tangosol.coherence.config.Config;
24+
2325
import java.net.ProtocolFamily;
2426
import java.net.SocketOption;
2527
import java.net.SocketTimeoutException;
@@ -3170,9 +3172,7 @@ public DefaultDependencies setLogger(Logger logger)
31703172
int nBacklog = Integer.MAX_VALUE;
31713173
try
31723174
{
3173-
nBacklog = Integer.parseInt(System.getProperty(
3174-
MultiplexedSocketProvider.class.getName() +
3175-
".server.backlog", Integer.toString(nBacklog)));
3175+
nBacklog = Config.getInteger(MultiplexedSocketProvider.class.getName() + ".server.backlog", nBacklog);
31763176
}
31773177
catch (Throwable t) {}
31783178
s_nBacklogDefault = nBacklog;
@@ -3200,9 +3200,8 @@ public DefaultDependencies setLogger(Logger logger)
32003200
long cMillisId = 0;
32013201
try
32023202
{
3203-
cMillisId = new Duration(System.getProperty(
3204-
MultiplexedSocketProvider.class.getName() +
3205-
".server.identification.timeout", "1m")).as(Duration.Magnitude.MILLI); // default doc'd on getIdentificationTimeoutMillis
3203+
cMillisId = Config.getDuration(MultiplexedSocketProvider.class.getName() + ".server.identification.timeout",
3204+
new Duration(1, Duration.Magnitude.MINUTE)).as(Duration.Magnitude.MILLI); // default doc'd on getIdentificationTimeoutMillis
32063205
}
32073206
catch (Throwable t) {}
32083207
s_cMillisIdentifyDefault = cMillisId;

prj/coherence-core/src/main/java/com/oracle/coherence/common/internal/net/socketbus/SocketBusDriver.java

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* Copyright (c) 2000, 2021, Oracle and/or its affiliates.
2+
* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
33
*
44
* Licensed under the Universal Permissive License v 1.0 as shown at
5-
* http://oss.oracle.com/licenses/upl.
5+
* https://oss.oracle.com/licenses/upl.
66
*/
77
package com.oracle.coherence.common.internal.net.socketbus;
88

@@ -21,6 +21,8 @@
2121
import com.oracle.coherence.common.util.Duration;
2222
import com.oracle.coherence.common.util.MemorySize;
2323

24+
import com.tangosol.coherence.config.Config;
25+
2426
import java.io.IOException;
2527
import java.net.SocketAddress;
2628
import java.net.ServerSocket;
@@ -938,8 +940,8 @@ protected DefaultDependencies validate()
938940
"memory and mess bus protocols cannot use the sane names");
939941
}
940942

941-
m_cAckTimeoutMillis = new Duration(System.getProperty( SocketBusDriver.class.getName()+".ackTimeoutMillis",
942-
getDefaultAckTimeoutMillis() + "ms")).getNanos()/1000000;
943+
m_cAckTimeoutMillis = Config.getDuration(SocketBusDriver.class.getName() + ".ackTimeoutMillis",
944+
new Duration(getDefaultAckTimeoutMillis(), Duration.Magnitude.MILLI)).as(Duration.Magnitude.MILLI);
943945

944946
return this;
945947
}
@@ -1006,22 +1008,22 @@ protected static void ensureArgument(Object o, String sName)
10061008
/**
10071009
* Reconnect interval for the Connection in millis
10081010
*/
1009-
protected long m_cReconnectDelayMillis = new Duration(System.getProperty(
1010-
SocketBusDriver.class.getName()+".reconnectDelayMillis", "200ms")).getNanos()/1000000;
1011+
protected long m_cReconnectDelayMillis =
1012+
Config.getDuration(SocketBusDriver.class.getName() + ".reconnectDelayMillis",
1013+
new Duration(200, Duration.Magnitude.MILLI)).as(Duration.Magnitude.MILLI);
10111014

10121015
/**
10131016
* The maximum number of sequential reconnects to attempt.
10141017
* <p>
10151018
* A value of -1 indicates that no reconnects should be attempted.
10161019
*/
1017-
protected int m_cReconnectLimit = Integer.parseInt(System.getProperty(
1018-
SocketBusDriver.class.getName()+".reconnectLimit", "3"));
1020+
protected int m_cReconnectLimit = Config.getInteger(SocketBusDriver.class.getName()+".reconnectLimit", 3);
10191021

10201022
/**
10211023
* Maximum receipt ack delay in millis
10221024
*/
1023-
protected long m_cMaxReceiptDelayMillis = new Duration(System.getProperty(
1024-
SocketBusDriver.class.getName()+".maxReceiptDelayMillis", "500ms")).getNanos()/1000000;
1025+
protected long m_cMaxReceiptDelayMillis = Config.getDuration(SocketBusDriver.class.getName()+".maxReceiptDelayMillis",
1026+
new Duration(500, Duration.Magnitude.MILLI)).as(Duration.Magnitude.MILLI);
10251027

10261028
/**
10271029
* Ack timeout in millis
@@ -1037,59 +1039,54 @@ protected static void ensureArgument(Object o, String sName)
10371039
/**
10381040
* Fatal ack timeout in millis
10391041
*/
1040-
protected long m_cAckFatalTimeoutMillis = new Duration(System.getProperty(
1041-
SocketBusDriver.class.getName()+".fatalTimeoutMillis", "10m")).getNanos()/1000000;
1042+
protected long m_cAckFatalTimeoutMillis = Config.getDuration(SocketBusDriver.class.getName()+".fatalTimeoutMillis",
1043+
new Duration(10, Duration.Magnitude.MINUTE)).as(Duration.Magnitude.MILLI);
10421044

10431045
/**
10441046
* Heartbeat interval in millis, disabled by default now that we support reconnects
10451047
*/
1046-
protected long m_cHeartbeatDelayMillis = new Duration(System.getProperty(
1047-
SocketBusDriver.class.getName()+".heartbeatInterval", "0s")).getNanos()/1000000;
1048+
protected long m_cHeartbeatDelayMillis = Config.getDuration(SocketBusDriver.class.getName()+".heartbeatInterval",
1049+
new Duration("0s")).as(Duration.Magnitude.MILLI);
10481050

10491051
/**
10501052
* Auto flush threshold
10511053
*/
1052-
protected long m_cbAutoFlush = getSafeMemorySize(System.getProperty(
1053-
SocketBusDriver.class.getName()+".autoFlushThreshold"));
1054+
protected long m_cbAutoFlush = getSafeMemorySize(SocketBusDriver.class.getName()+".autoFlushThreshold");
10541055

10551056
/**
10561057
* Threshold after which to request receipts.
10571058
*/
1058-
protected long m_cbReceiptRequest = getSafeMemorySize(System.getProperty(
1059-
SocketBusDriver.class.getName()+".receiptRequestThreshold"));
1059+
protected long m_cbReceiptRequest = getSafeMemorySize(SocketBusDriver.class.getName()+".receiptRequestThreshold");
10601060

10611061
/**
10621062
* The maximum number of concurrent writers on which to attempt direct writes.
10631063
*/
1064-
protected int m_cThreadsDirect = Integer.parseInt(System.getProperty(
1065-
SocketBusDriver.class.getName() + ".directWriteThreadThreshold", "4"));
1064+
protected int m_cThreadsDirect = Config.getInteger(
1065+
SocketBusDriver.class.getName() + ".directWriteThreadThreshold", 4);
10661066

10671067
/**
10681068
* The drop ratio.
10691069
*/
1070-
protected int m_nDropRatio = Integer.parseInt(System.getProperty(
1071-
SocketBusDriver.class.getName() + ".dropRatio", "0"));
1070+
protected int m_nDropRatio = Config.getInteger(
1071+
SocketBusDriver.class.getName() + ".dropRatio", 0);
10721072

10731073
/**
10741074
* The force corruption ratio.
10751075
*/
1076-
protected int m_nCorruptionRatio = Integer.parseInt(System.getProperty(
1077-
SocketBusDriver.class.getName() + ".corruptionRatio", "0"));
1076+
protected int m_nCorruptionRatio = Config.getInteger(
1077+
SocketBusDriver.class.getName() + ".corruptionRatio", 0);
10781078

10791079
/**
10801080
* True iff CRC validation is enabled
10811081
*/
1082-
protected boolean m_fCrc = Boolean.parseBoolean(System.getProperty(
1083-
SocketBusDriver.class.getName() + ".crc", "false"));
1082+
protected boolean m_fCrc = Config.getBoolean(SocketBusDriver.class.getName() + ".crc", false);
10841083

10851084

1086-
private static long getSafeMemorySize(String sValue)
1085+
private static long getSafeMemorySize(String sName)
10871086
{
1088-
if (sValue == null)
1089-
{
1090-
return -1;
1091-
}
1092-
return new MemorySize(sValue).getByteCount();
1087+
MemorySize size = Config.getMemorySize(sName);
1088+
1089+
return size == null ? -1 : size.getByteCount();
10931090
}
10941091

10951092
// ----- constants ----------------------------------------------
@@ -1101,7 +1098,7 @@ private static long getSafeMemorySize(String sValue)
11011098

11021099
static
11031100
{
1104-
String sManager = System.getProperty(SocketBusDriver.class.getName() + ".bufferManager", "network");
1101+
String sManager = Config.getProperty(SocketBusDriver.class.getName() + ".bufferManager", "network");
11051102
switch (sManager)
11061103
{
11071104
case "heap":
@@ -1156,10 +1153,10 @@ public Object getOption(int optID)
11561153
}
11571154
}
11581155

1159-
final int RX_BUFFER_SIZE = (int) getSafeMemorySize(System.getProperty(
1160-
SocketBusDriver.class.getName()+".socketRxBuffer"));
1161-
final int TX_BUFFER_SIZE = (int) getSafeMemorySize(System.getProperty(
1162-
SocketBusDriver.class.getName()+".socketTxBuffer"));
1156+
final int RX_BUFFER_SIZE = (int) getSafeMemorySize(
1157+
SocketBusDriver.class.getName()+".socketRxBuffer");
1158+
final int TX_BUFFER_SIZE = (int) getSafeMemorySize(
1159+
SocketBusDriver.class.getName()+".socketTxBuffer");
11631160
};
11641161
}
11651162

prj/coherence-core/src/main/java/com/oracle/coherence/common/internal/util/HeapDump.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
/*
2-
* Copyright (c) 2000, 2022, Oracle and/or its affiliates.
2+
* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
33
*
44
* Licensed under the Universal Permissive License v 1.0 as shown at
5-
* http://oss.oracle.com/licenses/upl.
5+
* https://oss.oracle.com/licenses/upl.
66
*/
77
package com.oracle.coherence.common.internal.util;
88

99

10+
import com.tangosol.coherence.config.Config;
11+
1012
import java.nio.file.Files;
1113
import java.nio.file.Path;
1214
import javax.management.MBeanServer;
@@ -43,24 +45,24 @@ public static String dumpHeapForBug(String sBugId)
4345
String sClass = HeapDump.class.getName();
4446
String sPropBug = sClass + "." + sBugId;
4547

46-
if (Boolean.parseBoolean(System.getProperty(sPropBug, System.getProperty(sClass, "false"))))
48+
if (Config.getBoolean(sPropBug, Config.getBoolean(sClass, false)))
4749
{
4850
String sFileName;
4951
try
5052
{
5153
String sDirName;
5254
try
5355
{
54-
sDirName = System.getProperty(sClass + ".dir", System.getProperty("java.io.tmpdir", "."));
56+
sDirName = Config.getProperty(sClass + ".dir", System.getProperty("java.io.tmpdir", "."));
5557
}
5658
catch (Throwable t)
5759
{
5860
sDirName = ".";
5961
}
6062

6163
File fileDir = new File(sDirName);
62-
int cLimit = Integer.parseInt(System.getProperty(sPropBug + ".limit",
63-
System.getProperty(sClass + ".limit", "3")));
64+
int cLimit = Config.getInteger(sPropBug + ".limit",
65+
Config.getInteger(sClass + ".limit", 3));
6466

6567
if (cLimit <= 0)
6668
{
@@ -124,8 +126,8 @@ public static String dumpHeap(String sFileName, boolean fLive)
124126
{
125127
try
126128
{
127-
sFileName = System.getProperty(HeapDump.class.getName() + ".dir",
128-
System.getProperty("java.io.tmpdir", "."));
129+
sFileName = Config.getProperty(HeapDump.class.getName() + ".dir",
130+
System.getProperty("java.io.tmpdir", "."));
129131
}
130132
catch (Throwable t)
131133
{

0 commit comments

Comments
 (0)