#Create bitbucket branch
##Create local branch
$ git checkout -b sync
Switched to a new branch 'sync'
$ git branch
master
* sync
package net.reznik.gist; | |
import static io.netty.buffer.Unpooled.copiedBuffer; | |
import static io.netty.handler.codec.http.HttpHeaders.isKeepAlive; | |
import static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE; | |
import static io.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST; | |
import static io.netty.handler.codec.http.HttpResponseStatus.OK; | |
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1; | |
import io.netty.buffer.ByteBuf; | |
import io.netty.buffer.ByteBufOutputStream; |
package com.lubin.study; | |
import scala.annotation.tailrec | |
sealed trait MyList[+A] | |
abstract class MyListOpt[+A](myList: MyList[A]) { | |
def head(): A | |
def tail(): MyList[A] | |
def setHead[B >: A](head: B): MyList[B] |
package com.lubin.study | |
import scala.Ordered.orderingToOrdered | |
object OrderingAndOrderedTest extends App { | |
class Fraction(n: Int, d: Int) { | |
def value: Double = n.asInstanceOf[Double] / d.asInstanceOf[Double] | |
override def toString(): String = n + "/" + d | |
} |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.Future; | |
import com.ning.http.client.AsyncCompletionHandler; | |
import com.ning.http.client.AsyncHttpClient; | |
import com.ning.http.client.AsyncHttpClientConfig; | |
import com.ning.http.client.Response; | |
import com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig; | |
#Create bitbucket branch
##Create local branch
$ git checkout -b sync
Switched to a new branch 'sync'
$ git branch
master
* sync
package com.crm.test; | |
import java.util.List; | |
import java.util.concurrent.Callable; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.ScheduledExecutorService; | |
import java.util.concurrent.TimeUnit; | |
import com.linkedin.parseq.BaseTask; | |
import com.linkedin.parseq.Context; |
public class BigLockCalculator extends CalculatorBase { | |
private interface Status { | |
int NotStarted =1; | |
int Starting =2; | |
int Started =3; | |
int Disposed =4; | |
} | |
private AtomicInteger _status = new AtomicInteger(Status.NotStarted); |
/////////////////////////////////////////////////////// | |
// Talk is cheap. Show me the code. - Linus Torvalds | |
/////////////////////////////////////////////////////// | |
public abstract class CalculatorBase : IDisposable { | |
protected void StartCore() { | |
// ... | |
} | |
/* | |
** Copyright (c) 2012, Alex Fok [email protected] | |
** All rights reserved. | |
** | |
** This program is free software: you can redistribute it and/or modify | |
** it under the terms of the Lesser GNU General Public License as published by | |
** the Free Software Foundation, either version 3 of the License, or | |
** (at your option) any later version. | |
** |
public static byte[] serialize(Object o) throws IOException | |
{ | |
// Kryo kryo = new Kryo(); | |
// kryo.setDefaultSerializer(CompatibleFieldSerializer.class); | |
// Output output = new Output(4096, -1); | |
// kryo.writeClassAndObject(output,o); | |
// output.close(); | |
// return output.toBytes(); | |
ByteArrayOutputStream ostream = new ByteArrayOutputStream(); |