Hi,
I normally do something like this:
[code]
private void createConfigConnection() {
try {
log.debug("Start of Config Connection.");
// Implement ADDP
PropertyConfiguration options = new PropertyConfiguration();
options.setUseAddp(true);
options.setAddpClientTimeout(3);
options.setAddpServerTimeout(4);
options.setAddpTraceMode(AddpTraceMode.Local);
// Create primary and backup endpoints.
List<Endpoint> endpoints = new LinkedList<Endpoint>();
endpoints.add(new Endpoint("demosrv", 3333, options));
endpoints.add(new Endpoint("demosrv", 20201, options));
//Create the protocol, set the endpoint to one of the above endpoints.
protocol = new ConfServerProtocol();
//Set name of type of Client
protocol.setClientName("MyAppName");
protocol.setClientApplicationType(CfgAppType.CFGThirdPartyServer.ordinal());
protocol.setEndpoint(endpoints.get(0));
//Create the Warm Standby Config
WSConfig wsconfig = new WSConfig();
wsconfig.setEndpoints(endpoints);
//Create the WarmStandy object
WarmStandby warmStandby = new WarmStandby(protocol);
warmStandby.setConfig(wsconfig);
warmStandby.setHandler(this);
this.wsEnabledClient = warmStandby;
//Create the ConfService
service = ConfServiceFactory.createConfService(protocol);
singleThreadInvoker = new SingleThreadInvoker();
service.setInvoker(singleThreadInvoker);
//Start to try to connect, if we connect and then get disconnected it will still try to connect.
wsEnabledClient.autoRestore();
} catch (Exception e) {
log.error("Error Connecting to Config Server", e);
}
}
[/code]