View Javadoc
1   package org.oxerr.huobi.xchange.service.streaming;
2   
3   import java.util.Arrays;
4   import java.util.HashSet;
5   import java.util.Set;
6   
7   import com.xeiam.xchange.currency.CurrencyPair;
8   import com.xeiam.xchange.service.streaming.ExchangeStreamingConfiguration;
9   
10  public class HuobiStreamingConfiguration implements
11  		ExchangeStreamingConfiguration {
12  
13  	private final int maxReconnectAttempts;
14  	private final int reconnectWaitTimeInMs;
15  	private final Set<CurrencyPair> currencyPairs = new HashSet<>();
16  
17  	public HuobiStreamingConfiguration(CurrencyPair... currencyPairs) {
18  		this(Arrays.asList(currencyPairs));
19  	}
20  
21  	public HuobiStreamingConfiguration(Iterable<CurrencyPair> currencyPairs) {
22  		this(currencyPairs, 0, 0);
23  	}
24  
25  	public HuobiStreamingConfiguration(Iterable<CurrencyPair> currencyPairs,
26  			int maxReconnectAttempts, int reconnectWaitTimeInMs) {
27  		for (CurrencyPair currencyPair : currencyPairs) {
28  			this.currencyPairs.add(currencyPair);
29  		}
30  
31  		this.maxReconnectAttempts = maxReconnectAttempts;
32  		this.reconnectWaitTimeInMs = reconnectWaitTimeInMs;
33  	}
34  
35  	/**
36  	 * {@inheritDoc}
37  	 */
38  	@Override
39  	public int getMaxReconnectAttempts() {
40  		return maxReconnectAttempts;
41  	}
42  
43  	/**
44  	 * {@inheritDoc}
45  	 */
46  	@Override
47  	public int getReconnectWaitTimeInMs() {
48  		return reconnectWaitTimeInMs;
49  	}
50  
51  	/**
52  	 * {@inheritDoc}
53  	 */
54  	@Override
55  	public int getTimeoutInMs() {
56  		return 0;
57  	}
58  
59  	/**
60  	 * {@inheritDoc}
61  	 */
62  	@Override
63  	public boolean isEncryptedChannel() {
64  		return false;
65  	}
66  
67  	/**
68  	 * {@inheritDoc}
69  	 */
70  	@Override
71  	public boolean keepAlive() {
72  		return false;
73  	}
74  
75  	public Set<CurrencyPair> getCurrencyPairs() {
76  		return currencyPairs;
77  	}
78  
79  }