Example usage for org.springframework.core.task SimpleAsyncTaskExecutor execute

List of usage examples for org.springframework.core.task SimpleAsyncTaskExecutor execute

Introduction

In this page you can find the example usage for org.springframework.core.task SimpleAsyncTaskExecutor execute.

Prototype

@Override
public void execute(Runnable task) 

Source Link

Document

Executes the given task, within a concurrency throttle if configured (through the superclass's settings).

Usage

From source file:to.sparks.mtgox.example.TradingBot.java

public TradingBot(SimpleAsyncTaskExecutor taskExecutor, MtGoxHTTPClient mtgoxAPI) throws Exception {
    this.mtgoxAPI = mtgoxAPI;
    this.taskExecutor = taskExecutor;

    AccountInfo info = mtgoxAPI.getAccountInfo();
    logger.log(Level.INFO, "Logged into account: {0}", info.getLogin());

    baseCurrency = mtgoxAPI.getCurrencyInfo(mtgoxAPI.getBaseCurrency());
    String currencyCode = baseCurrency.getCurrency().getCurrencyCode();
    logger.log(Level.INFO, "Configured base currency: {0}", currencyCode);
    lastTicker = mtgoxAPI.getTicker();//from www .  j av  a 2  s . c  o m
    taskExecutor.execute(new Logic());

    logger.info("Waiting for trade events to trigger bot activity...");
}