Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * #%L
   * Service Locator Client for CXF
   * %%
   * Copyright (C) 2011 Talend Inc.
   * %%
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
  * 
  *      http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * #L%
  */
 package org.talend.esb.locator;
 
 
CXF feature to enable the locator client with an CXF service.
 
 public class LocatorFeature extends AbstractFeature {
 
 	private static final Logger LOG = Logger.getLogger(ServiceLocator.class
 			.getName());
 
 
 	private int sessionTimeout;
 
 	private int connectionTimeout;
 
 	private String prefix;
 
 	public void initialize(Client clientBus bus) {
         selector.setEndpoint(client.getEndpoint());
 		
 		ServiceLocator sl = null;
 
 
 		if (.isLoggable(.)) {
 			.log(."Successfully initialized locator feature");
 		}
 
         client.setConduitSelector(selector);
 
 	}
 
 	public void initialize(Server serverBus bus) {
 		try {
 			
 			if (.isLoggable(.)) {
 				.log(."Successfully initialized locator feature");
 			}
 
 		} catch (InterruptedException e) {
 						"Interrupted Exception thrown during initialization of the locator feature."e);
 			}
 		} catch (ServiceLocatorException e) {
 						"ServiceLocator Exception thrown during initialization of the locator feature."e);
 			}
 		}
 	}

Specify the endpoints of all the instances belonging to the service locator ensemble the service locator client might be talking to. The service locator client will one by one pick an endpoint (the order is non-deterministic) to connect to the service locator until a connection is established.

Parameters:
endpoints comma separated list of endpoints,each corresponding to a servicelocator instance. Each endpoint is specified as a host:port pair. At least one endpoint must be specified. Valid exmaples are: "127.0.0.1:2181" or "sl1.example.com:3210, sl2.example.com:3210, sl3.example.com:3210"
	public void setLocatorEndpoints(String endpoints) {
		 = endpoints;
	}

Specify the time out of the session established at the server. The session is kept alive by requests sent by the client. If the session is idle for a period of time that would timeout the session, the client will send a PING request to keep the session alive.

Parameters:
sessionTimeout timeout in milliseconds, must be greater than zero and less than 60000.
	public void setSessionTimeout(int sessionTimeout) {
		this. = sessionTimeout;
	}

Specify the time the service locator client waits for a connection to get established.

Parameters:
connectionTimeout timeout in milliseconds, must be greater than zero
	public void setConnectionTimeout(int connectionTimeout) {
		this. = connectionTimeout;
	}
	public void setEndpointPrefix(String prefix) {
		this. = prefix;
	}
		if ( != null) {
		}
		if ( > 0) {
		}
		if ( > 0) {
		}
		try {
			sl.connect();
				.log(."Successfully initialized locator feature");
			}
catch (InterruptedException e) {
						"Interrupted Exception thrown during initialization of the locator feature."e);
			}
catch (ServiceLocatorException e) {
						"ServiceLocator Exception thrown during initialization of the locator feature."e);
			}
		}
		return sl;
	}
		lr.setBus(bus);
		if ( != null) {
		}
		lr.init();
		return lr;
	}
New to GrepCode? Check out our FAQ X