Java tutorial
/******************************************************************************* * Copyright (c) 2008, 2009 SOPERA GmbH. * All rights reserved. This program and the accompanying materials * 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: * SOPERA GmbH - initial API and implementation *******************************************************************************/ package $servicePackage$; import java.util.Timer; import java.util.TimerTask; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.util.Assert; import $serviceClientPackage$.$serviceImpl$; public class $serviceImpl$ClientInvoker implements InitializingBean { private static final Log LOG = LogFactory.getLog($serviceImpl$ClientInvoker.class); private Integer delayBeforeSending = 5000; private $serviceImpl$ $serviceImplInstance$; public $serviceImpl$ get$serviceImpl$() { return $serviceImplInstance$; } public void set$serviceImpl$($serviceImpl$ $serviceImplInstance$) { this.$serviceImplInstance$ = $serviceImplInstance$; } public Integer getDelayBeforeSending() { return delayBeforeSending; } public void setDelayBeforeSending(Integer delayBeforeSending) { this.delayBeforeSending = delayBeforeSending; } public void afterPropertiesSet() throws Exception { Assert.notNull($serviceImplInstance$); Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { try { performRequest(); } catch (Exception ex) { throw new RuntimeException(ex); } } }, delayBeforeSending); } private void performRequest() { LOG.info("Performing invocation on ..."); /*Implementation*/ LOG.info("Result of runing is...."); } }