This file contains hidden or 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
public enum CouchbaseCachingClient implements ICachingClient { | |
INSTANCE; | |
private final org.slf4j.Logger logger = Logger.init(CouchbaseCachingClient.class); | |
/** | |
* A default key used for constructing a JsonNode from a String | |
* when storing Strings into Couchbase. |
This file contains hidden or 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
/** | |
* Converts an instance of <code>Observable<T></code> into | |
* an instance of <code>F.Promise<T></code> | |
* | |
* @return A <code>Promise<T></code> containing the value | |
* emitted by the observable | |
*/ | |
public static <T> Function<Observable<T>, F.Promise<T>> observableToFuture() | |
{ | |
return obs -> { |
This file contains hidden or 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 ClientConfiguration getClientConfigueration() { | |
Assert.notNull(proxy, "Proxy address not found!"); | |
return Try.of(() -> new URI(proxy)) | |
.map(uri -> new ClientConfiguration() | |
.withProxyHost(uri.getHost()) | |
.withProxyPort(uri.getPort())).getOrElseThrow(throwable -> | |
new S3StorageException("Unable to create client, proxy not available", throwable)); | |
} |
This file contains hidden or 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 ClientConfiguration getClientConfigueration() { | |
Assert.notNull(proxy, "Proxy address not found!"); | |
String host; | |
int port; | |
try { | |
URI uri = new URI(proxy); | |
host = uri.getHost(); | |
port = uri.getPort(); | |
} catch (URISyntaxException e) { | |
logger.error("Error creating client", e); |
This file contains hidden or 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
Number plusOne = Match(obj).of( | |
Case(instanceOf(Integer.class), i -> i + 1), | |
Case(instanceOf(Double.class), d -> d + 1), | |
Case($(), o -> { throw new NumberFormatException(); }) | |
); |
This file contains hidden or 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
import javaslang.control.Try; | |
import rx.Observable; | |
import rx.schedulers.Schedulers; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
import java.util.stream.IntStream; |
This file contains hidden or 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
#!/usr/bin/env bash | |
# | |
set -e | |
pushd "$(mktemp -dt akka)" | |
cat >build.sbt <<EOM | |
scalaVersion := "2.11.6" | |
libraryDependencies ++= Seq( |
This file contains hidden or 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
#!/usr/bin/env bash | |
# | |
set -e | |
pushd "$(mktemp -dt akka)" | |
cat >build.sbt <<EOM | |
scalaVersion := "2.11.6" | |
val akkaVersion = "2.5.6" | |
val akkaHTTPVersion = "10.0.9" |
This file contains hidden or 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
object WebServer { | |
def main(args: Array[String]) { | |
implicit val system = ActorSystem("my-system") | |
implicit val materializer = ActorMaterializer() | |
implicit val executionContext = system.dispatcher | |
var counter = 0 | |
val route = post { counter +=1 | |
complete(s"Counter incremented to $counter") | |
} ~ get { complete(HttpEntity(ContentTypes.`text/html(UTF-8)`, s"counter is $counter")) |
This file contains hidden or 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
//Returns a list of Jobname: BuildNumbers that contain the term provided | |
def searchLogsForTerm(term) { | |
def folders = { item -> | |
item instanceof jenkins.branch.OrganizationFolder | |
} | |
Jenkins.instance.items.findAll(folders).collect { organizationFolder -> organizationFolder.items}.flatten() | |
.collect { workflowMultiBranchProject -> workflowMultiBranchProject.items }.flatten() | |
.collect { workflowJob -> | |
def matchingBuilds = workflowJob.builds.findAll { build -> build.log.contains(term) } |
OlderNewer