This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2020-08-18 16:51:09.753 [main] INFO c.g.a.c.h.HttpRequest - curl -v --compressed -X POST -H 'Accept-Encoding: gzip' -H 'Authorization: <Not Logged>' -H 'User-Agent: great36 Google-API-Java-Client/1.30.10 Google-HTTP-Java-Client/1.36.0 (gzip)' -H 'x-goog-api-client: gl-java/11.0.4 gdcl/1.30.10 mac-os-x/10.14.6' -H 'Content-Type: application/json; charset=UTF-8' -H 'Content-Encoding: gzip' -d '@-' -- 'https://www.googleapis.com/calendar/v3/calendars/3fxxxxxxxxxxxxxxxxxxxxdggc@group.calendar.google.com/events' << $$$ | |
2020-08-18 16:51:09.754 [main] TRACE s.u.l.i.LoggingProviderImpl$JULWrapper - ProxySelector Request for https://www.googleapis.com/calendar/v3/calendars/3fxxxxxxxxxxxxxxxxxxxxdggc@group.calendar.google.com/events | |
2020-08-18 16:51:09.754 [main] TRACE s.u.l.i.LoggingProviderImpl$JULWrapper - Looking for HttpClient for URL https://www.googleapis.com/calendar/v3/calendars/3fxxxxxxxxxxxxxxxxxxxxdggc@group.calendar.google.com/events and proxy value of DIRECT | |
2020-08-18 16:51:09.755 [main] TRACE s.u.l.i. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package moshi | |
import com.squareup.moshi.* | |
interface IRunnable { | |
fun run() | |
} | |
class Cat : IRunnable { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IRunnable { | |
fun run() | |
} | |
class Horse : IRunnable { | |
override fun run() { | |
println("horse running") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IRunnable { | |
fun run() | |
} | |
class Horse : IRunnable { | |
override fun run() { | |
println("horse running") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package destiny | |
import kotlinx.coroutines.* | |
import kotlinx.coroutines.channels.Channel | |
import kotlinx.coroutines.flow.* | |
import mu.KotlinLogging | |
import okhttp3.OkHttpClient | |
import okhttp3.Request | |
/** | |
* ru.gildor.coroutines:kotlin-coroutines-okhttp:1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package destiny | |
import kotlinx.coroutines.* | |
import kotlinx.coroutines.channels.Channel | |
import kotlinx.coroutines.flow.* | |
import mu.KotlinLogging | |
import org.apache.http.client.fluent.Request | |
import java.net.URLEncoder | |
import kotlin.test.Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private suspend fun method1a(longUrl: String): String { | |
return impls.asSequence().asFlow().flatMapMerge(impls.size) { impl -> | |
flow { | |
impl.getShortUrl(longUrl)?.also { | |
emit(it) | |
} | |
}.flowOn(Dispatchers.IO) | |
}.first() | |
.also { Dispatchers.IO.cancelChildren() } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IsgdImpl : UrlShorter { | |
override suspend fun getShortUrl(longUrl: String): String? { | |
logger.info("running : {}", Thread.currentThread().name) | |
val url = "https://is.gd/create.php?format=simple&url=%s".format(URLEncoder.encode(longUrl, "UTF-8")) | |
return withContext(Dispatchers.IO) { | |
logger.info("running Dispatchers.IO : {}", Thread.currentThread().name) | |
Request.Get(url).also { | |
sleep(1000) | |
//delay(1000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// delay ISGD more | |
class IsgdImpl : UrlShorter { | |
override suspend fun getShortUrl(longUrl: String): String? { | |
logger.info("running : {}", Thread.currentThread().name) | |
val url = "https://is.gd/create.php?format=simple&url=%s".format(URLEncoder.encode(longUrl, "UTF-8")) | |
return withContext(Dispatchers.IO) { | |
logger.info("running Dispatchers.IO : {}", Thread.currentThread().name) | |
Request.Get(url).also { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package destiny | |
import kotlinx.coroutines.* | |
import kotlinx.coroutines.channels.Channel | |
import kotlinx.coroutines.flow.* | |
import mu.KotlinLogging | |
import org.apache.http.client.fluent.Request | |
import java.net.URLEncoder | |
import java.util.concurrent.ExecutorService | |
import java.util.concurrent.Executors |
NewerOlder