diff options
Diffstat (limited to 'framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/GenericContainerInstantiator.java')
-rw-r--r-- | framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/GenericContainerInstantiator.java | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/GenericContainerInstantiator.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/GenericContainerInstantiator.java index 0ffd749a3..429b4b3c3 100644 --- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/GenericContainerInstantiator.java +++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/GenericContainerInstantiator.java @@ -107,7 +107,10 @@ public class GenericContainerInstantiator implements IContainerInstantiator, IRe return keepAlive; } - InetAddress getBindAddress() { + /** + * @since 4.5 + */ + public InetAddress getBindAddress() { return bindAddress; } } @@ -265,19 +268,33 @@ public class GenericContainerInstantiator implements IContainerInstantiator, IRe return port; } + /** + * @since 4.5 + */ + protected IContainer createClientContainer(GenericContainerArgs gcargs) throws Exception { + return new TCPClientSOContainer(new SOContainerConfig(gcargs.getID()), gcargs.getKeepAlive().intValue()); + } + + /** + * @since 4.5 + */ + protected IContainer createServerContainer(GenericContainerArgs gcargs) throws Exception { + return new TCPServerSOContainer(new SOContainerConfig(gcargs.getID()), gcargs.getBindAddress(), gcargs.getKeepAlive().intValue()); + } + public IContainer createInstance(ContainerTypeDescription description, Object[] args) throws ContainerCreateException { boolean isClient = isClient(description); try { GenericContainerArgs gcargs = null; if (isClient) { gcargs = getClientArgs(args); - return new TCPClientSOContainer(new SOContainerConfig(gcargs.getID()), gcargs.getKeepAlive().intValue()); + return createClientContainer(gcargs); } // This synchronized block is to prevent issues with // multithreaded access to ServerPort (to find available port) synchronized (this) { gcargs = getServerArgs(args); - return new TCPServerSOContainer(new SOContainerConfig(gcargs.getID()), gcargs.getBindAddress(), gcargs.getKeepAlive().intValue()); + return createServerContainer(gcargs); } } catch (Exception e) { Trace.catching(ProviderPlugin.PLUGIN_ID, ECFProviderDebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "createInstance", e); //$NON-NLS-1$ |