Skip to content
This repository has been archived by the owner on Oct 27, 2021. It is now read-only.

migrate to rxJava3 #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ task javadocJar(type: Jar) {
}

dependencies {
implementation "io.reactivex.rxjava2:rxjava:2.2.4"

compileOnly 'com.squareup.okhttp3:okhttp:3.12.0'
implementation 'io.reactivex.rxjava3:rxjava:3.0.0'
compileOnly 'com.squareup.okhttp3:okhttp:4.0.1'
compileOnly 'com.google.code.gson:gson:2.8.5'
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kr.jadekim.rxjava.websocket.connection;

import io.reactivex.Observable;
import io.reactivex.rxjava3.core.Observable;

public interface Connection {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package kr.jadekim.rxjava.websocket.connection;

import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.functions.Action;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.core.ObservableSource;
import io.reactivex.rxjava3.functions.Action;
import io.reactivex.rxjava3.functions.Supplier;
import kr.jadekim.rxjava.websocket.listener.WebSocketEventListener;

import java.util.concurrent.Callable;
Expand Down Expand Up @@ -31,14 +32,12 @@ public String getUrl() {

@Override
public Observable<String> getInboundStream() {
return Observable.defer(new Callable<ObservableSource<String>>() {

return Observable.defer(new Supplier<ObservableSource<? extends String>>() {
@Override
public ObservableSource<String> call() throws Exception {
public ObservableSource<? extends String> get() throws Throwable {
if (connection == null) {
connect();
}

return stream;
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package kr.jadekim.rxjava.websocket.connection.okhttp;

import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.core.ObservableEmitter;
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
import kr.jadekim.rxjava.websocket.connection.Connection;
import kr.jadekim.rxjava.websocket.listener.WebSocketEventListener;
import okhttp3.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package kr.jadekim.rxjava.websocket.processor;

import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.functions.Predicate;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.functions.Action;
import io.reactivex.rxjava3.functions.Consumer;
import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.functions.Predicate;
import kr.jadekim.rxjava.websocket.inbound.Inbound;
import kr.jadekim.rxjava.websocket.inbound.InboundParser;
import kr.jadekim.rxjava.websocket.listener.WebSocketEventListener;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package kr.jadekim.rxjava.websocket.processor;

import io.reactivex.*;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Predicate;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.functions.Action;
import io.reactivex.rxjava3.functions.Consumer;
import io.reactivex.rxjava3.functions.Predicate;
import kr.jadekim.rxjava.websocket.filter.ChannelFilter;
import kr.jadekim.rxjava.websocket.listener.WebSocketEventListener;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package kr.jadekim.rxjava.websocket.processor;

import io.reactivex.Completable;
import io.reactivex.CompletableEmitter;
import io.reactivex.CompletableOnSubscribe;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.subjects.PublishSubject;
import io.reactivex.rxjava3.core.Completable;
import io.reactivex.rxjava3.core.CompletableEmitter;
import io.reactivex.rxjava3.core.CompletableOnSubscribe;
import io.reactivex.rxjava3.functions.Consumer;
import io.reactivex.rxjava3.schedulers.Schedulers;
import io.reactivex.rxjava3.subjects.PublishSubject;
import kr.jadekim.rxjava.websocket.connection.Connection;
import kr.jadekim.rxjava.websocket.listener.WebSocketEventListener;
import kr.jadekim.rxjava.websocket.outbound.OutboundSerializer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package kr.jadekim.rxjava.websocket.processor;

import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.functions.Action;
import io.reactivex.rxjava3.functions.Consumer;
import io.reactivex.rxjava3.functions.Function;
import kr.jadekim.rxjava.websocket.inbound.Inbound;
import kr.jadekim.rxjava.websocket.inbound.InboundParser;
import kr.jadekim.rxjava.websocket.listener.WebSocketEventListener;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kr.jadekim.rxjava.websocket.processor;

import io.reactivex.Completable;
import io.reactivex.rxjava3.core.Completable;
import kr.jadekim.rxjava.websocket.connection.Connection;
import kr.jadekim.rxjava.websocket.inbound.InboundParser;
import kr.jadekim.rxjava.websocket.listener.WebSocketEventListener;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kr.jadekim.rxjava.websocket.processor;

import io.reactivex.*;
import io.reactivex.rxjava3.core.*;
import kr.jadekim.rxjava.websocket.annotation.*;

import java.lang.annotation.Annotation;
Expand Down Expand Up @@ -58,7 +58,7 @@ void runMethod(Class clientClass, String sentence, Map<String, Object> parameter
Matcher matcher = METHOD_PATTERN.matcher(sentence);

if (!matcher.find()) {
throw new IllegalArgumentException("올바르지 않은 값입니다. : " + sentence);
throw new IllegalArgumentException("Wrong value:" + sentence);
}

String onStartMethodName = matcher.group();
Expand Down