Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-07-16 07:26:32 +0000
committerEike Stepper2010-07-16 07:26:32 +0000
commit5fffebe7c4984c1ac2ff3a0a16295c80c451d2a0 (patch)
tree0f38e39eddc29c2c824f3861ddaed82bbaf98b65 /plugins/org.eclipse.net4j.tcp
parent41eb544051bc554bbeaed1135d0e42a0e2a84d09 (diff)
downloadcdo-5fffebe7c4984c1ac2ff3a0a16295c80c451d2a0.tar.gz
cdo-5fffebe7c4984c1ac2ff3a0a16295c80c451d2a0.tar.xz
cdo-5fffebe7c4984c1ac2ff3a0a16295c80c451d2a0.zip
[320076] Add a system property for the TCPAcceptor listen port
https://bugs.eclipse.org/bugs/show_bug.cgi?id=320076
Diffstat (limited to 'plugins/org.eclipse.net4j.tcp')
-rw-r--r--plugins/org.eclipse.net4j.tcp/META-INF/MANIFEST.MF10
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java24
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPAcceptor.java7
3 files changed, 32 insertions, 9 deletions
diff --git a/plugins/org.eclipse.net4j.tcp/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.tcp/META-INF/MANIFEST.MF
index 034e6aab7d..30db62c937 100644
--- a/plugins/org.eclipse.net4j.tcp/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.tcp/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.net4j.tcp;singleton:=true
-Bundle-Version: 3.0.100.qualifier
+Bundle-Version: 3.1.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -12,7 +12,7 @@ Bundle-ClassPath: .
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)";resolution:=optional,
org.eclipse.net4j;bundle-version="[3.0.0,4.0.0)";visibility:=reexport
Import-Package: org.osgi.framework;version="[1.3.0,2.0.0)";resolution:=optional
-Export-Package: org.eclipse.net4j.internal.tcp;version="3.0.100";x-friends:="org.eclipse.net4j.tests,org.eclipse.net4j.defs,org.eclipse.emf.cdo.examples",
- org.eclipse.net4j.internal.tcp.bundle;version="3.0.100";x-internal:=true,
- org.eclipse.net4j.internal.tcp.messages;version="3.0.100";x-internal:=true,
- org.eclipse.net4j.tcp;version="3.0.100"
+Export-Package: org.eclipse.net4j.internal.tcp;version="3.1.0";x-friends:="org.eclipse.net4j.tests,org.eclipse.net4j.defs,org.eclipse.emf.cdo.examples",
+ org.eclipse.net4j.internal.tcp.bundle;version="3.1.0";x-internal:=true,
+ org.eclipse.net4j.internal.tcp.messages;version="3.1.0";x-internal:=true,
+ org.eclipse.net4j.tcp;version="3.1.0"
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java
index 66f8b99230..f54a43c76b 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
*/
@@ -60,7 +60,7 @@ public class TCPAcceptor extends Acceptor implements ITCPAcceptor, ITCPPassiveSe
private String address = DEFAULT_ADDRESS;
- private int port = DEFAULT_PORT;
+ private int port = getDefaultPort();
public TCPAcceptor()
{
@@ -208,7 +208,7 @@ public class TCPAcceptor extends Acceptor implements ITCPAcceptor, ITCPPassiveSe
@Override
public String toString()
{
- return MessageFormat.format("TCPAcceptor[{0}:{1}]", address, port); //$NON-NLS-1$
+ return MessageFormat.format("TCPAcceptor[{0}:{1}]", address, port); //$NON-NLS-1$
}
@Override
@@ -256,4 +256,22 @@ public class TCPAcceptor extends Acceptor implements ITCPAcceptor, ITCPPassiveSe
{
return new TCPServerConnector(this);
}
+
+ private static int getDefaultPort()
+ {
+ try
+ {
+ String property = System.getProperty(DEFAULT_PORT_PROPERTY);
+ if (property != null)
+ {
+ return Integer.valueOf(property);
+ }
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+ }
+
+ return DEFAULT_PORT;
+ }
}
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPAcceptor.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPAcceptor.java
index cf3aaecb81..d7f21210f3 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPAcceptor.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPAcceptor.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
*/
@@ -22,6 +22,11 @@ public interface ITCPAcceptor extends IAcceptor
public static final int DEFAULT_PORT = 2036;
+ /**
+ * @since 3.1
+ */
+ public static final String DEFAULT_PORT_PROPERTY = "org.eclipse.net4j.tcp.acceptor.port";
+
public String getAddress();
public int getPort();

Back to the top