use of io.reactivex.annotations.Nullable in project RxJava by ReactiveX.
the class ObservableObserveOnTest method nonFusedPollThrows.
@Test
public void nonFusedPollThrows() {
new Observable<Integer>() {
@Override
protected void subscribeActual(Observer<? super Integer> observer) {
observer.onSubscribe(Disposables.empty());
@SuppressWarnings("unchecked") ObserveOnObserver<Integer> oo = (ObserveOnObserver<Integer>) observer;
oo.queue = new SimpleQueue<Integer>() {
@Override
public boolean offer(Integer value) {
return false;
}
@Override
public boolean offer(Integer v1, Integer v2) {
return false;
}
@Nullable
@Override
public Integer poll() throws Exception {
throw new TestException();
}
@Override
public boolean isEmpty() {
return false;
}
@Override
public void clear() {
}
};
oo.clear();
oo.schedule();
}
}.observeOn(Schedulers.single()).test().awaitDone(5, TimeUnit.SECONDS).assertFailure(TestException.class);
}
use of io.reactivex.annotations.Nullable in project XChange by knowm.
the class BitfinexStreamingAdapters method adaptPreTrade.
@Nullable
static BitfinexWebSocketAuthPreTrade adaptPreTrade(JsonNode preTrade) {
if (preTrade.size() < 12) {
LOG.error("addPreTrade unexpected record size={}, record={}", preTrade.size(), preTrade.toString());
return null;
}
long id = preTrade.get(0).longValue();
String pair = preTrade.get(1).textValue();
long mtsCreate = preTrade.get(2).longValue();
long orderId = preTrade.get(3).longValue();
BigDecimal execAmount = preTrade.get(4).decimalValue();
BigDecimal execPrice = preTrade.get(5).decimalValue();
String orderType = preTrade.get(6).textValue();
BigDecimal orderPrice = preTrade.get(7).decimalValue();
int maker = preTrade.get(8).intValue();
BitfinexWebSocketAuthPreTrade preTradeObject = new BitfinexWebSocketAuthPreTrade(id, pair, mtsCreate, orderId, execAmount, execPrice, orderType, orderPrice, maker);
LOG.debug("New pre trade: {}", preTradeObject);
return preTradeObject;
}
use of io.reactivex.annotations.Nullable in project XChange by knowm.
the class BitfinexStreamingAdapters method createBalanceObject.
@Nullable
private static BitfinexWebSocketAuthBalance createBalanceObject(JsonNode balance) {
if (balance.size() < 5) {
LOG.error("createBalanceObject unexpected record size={}, record={}", balance.size(), balance.toString());
return null;
}
String walletType = balance.get(0).textValue();
String currency = balance.get(1).textValue();
BigDecimal balanceValue = balance.get(2).decimalValue();
BigDecimal unsettledInterest = balance.get(3).decimalValue();
BigDecimal balanceAvailable = balance.get(4).asText().equals("null") ? null : balance.get(4).decimalValue();
return new BitfinexWebSocketAuthBalance(walletType, currency, balanceValue, unsettledInterest, balanceAvailable);
}
use of io.reactivex.annotations.Nullable in project XChange by knowm.
the class BitfinexStreamingAdapters method adaptTrade.
@Nullable
static BitfinexWebSocketAuthTrade adaptTrade(JsonNode trade) {
if (trade.size() < 11) {
LOG.error("addTrade unexpected record size={}, record={}", trade.size(), trade.toString());
return null;
}
long id = trade.get(0).longValue();
String pair = trade.get(1).textValue();
long mtsCreate = trade.get(2).longValue();
long orderId = trade.get(3).longValue();
BigDecimal execAmount = trade.get(4).decimalValue();
BigDecimal execPrice = trade.get(5).decimalValue();
String orderType = trade.get(6).textValue();
BigDecimal orderPrice = trade.get(7).decimalValue();
int maker = trade.get(8).intValue();
BigDecimal fee = trade.get(9).decimalValue();
String currency = trade.get(10).textValue();
BitfinexWebSocketAuthTrade tradeObject = new BitfinexWebSocketAuthTrade(id, pair, mtsCreate, orderId, execAmount, execPrice, orderType, orderPrice, maker, fee, currency);
LOG.debug("New trade: {}", tradeObject);
return tradeObject;
}
use of io.reactivex.annotations.Nullable in project XChange by knowm.
the class BitfinexStreamingAdapters method adaptOrder.
@Nullable
static BitfinexWebSocketAuthOrder adaptOrder(JsonNode order) {
BitfinexWebSocketAuthOrder orderObject = createOrderObject(order);
if (orderObject == null) {
return null;
}
LOG.debug("Updated order: {}", orderObject);
return orderObject;
}
Aggregations