Closing #555
This commit is contained in:
parent
6d94622878
commit
7f0358277b
9 changed files with 27 additions and 21 deletions
|
|
@ -89,7 +89,7 @@ private[amqp] class ConsumerActor(consumerParameters: ConsumerParameters)
|
||||||
case Some(params) => params.configurationArguments
|
case Some(params) => params.configurationArguments
|
||||||
case _ => Map.empty
|
case _ => Map.empty
|
||||||
}
|
}
|
||||||
ch.queueDeclare(queueName, durable, exclusive, autoDelete, JavaConversions.asMap(configurationArguments.toMap))
|
ch.queueDeclare(queueName, durable, exclusive, autoDelete, JavaConversions.asJavaMap(configurationArguments.toMap))
|
||||||
case NoActionDeclaration => new com.rabbitmq.client.impl.AMQImpl.Queue.DeclareOk(queueName, 0, 0) // do nothing here
|
case NoActionDeclaration => new com.rabbitmq.client.impl.AMQImpl.Queue.DeclareOk(queueName, 0, 0) // do nothing here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ abstract private[amqp] class FaultTolerantChannelActor(
|
||||||
exchangeDeclaration match {
|
exchangeDeclaration match {
|
||||||
case PassiveDeclaration => ch.exchangeDeclarePassive(exchangeName)
|
case PassiveDeclaration => ch.exchangeDeclarePassive(exchangeName)
|
||||||
case ActiveDeclaration(durable, autoDelete, _) =>
|
case ActiveDeclaration(durable, autoDelete, _) =>
|
||||||
ch.exchangeDeclare(exchangeName, exchangeType.toString, durable, autoDelete, JavaConversions.asMap(configurationArguments))
|
ch.exchangeDeclare(exchangeName, exchangeType.toString, durable, autoDelete, JavaConversions.asJavaMap(configurationArguments))
|
||||||
case NoActionDeclaration => // ignore
|
case NoActionDeclaration => // ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -368,10 +368,20 @@ trait RequestMethod extends Logging
|
||||||
case s => s
|
case s => s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def complete(status: Int, body: String): Boolean = complete(status, body, Headers())
|
def complete(status: Int, body: String): Boolean = complete(status, body, Headers())
|
||||||
|
|
||||||
def complete(status: Int, body: String, headers: Headers): Boolean =
|
def complete(status: Int, body: String, headers: Headers): Boolean =
|
||||||
|
rawComplete {
|
||||||
|
res => {
|
||||||
|
res.setStatus(status)
|
||||||
|
headers foreach {h => response.setHeader(h._1, h._2)}
|
||||||
|
res.getWriter.write(body)
|
||||||
|
res.getWriter.close
|
||||||
|
res.flushBuffer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def rawComplete(completion: HttpServletResponse => Unit): Boolean =
|
||||||
context match {
|
context match {
|
||||||
case Some(pipe) => {
|
case Some(pipe) => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -380,11 +390,7 @@ trait RequestMethod extends Logging
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
response.setStatus(status)
|
completion(response)
|
||||||
headers foreach {h => response.setHeader(h._1, h._2)}
|
|
||||||
response.getWriter.write(body)
|
|
||||||
response.getWriter.close
|
|
||||||
response.flushBuffer
|
|
||||||
pipe.complete
|
pipe.complete
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
@ -396,7 +402,7 @@ trait RequestMethod extends Logging
|
||||||
}
|
}
|
||||||
|
|
||||||
case None =>
|
case None =>
|
||||||
log.error("Attempt to complete request with no context. STATUS (" + status + ") BODY (" + body + ") HEADERS (" + headers + ")")
|
log.error("Attempt to complete request with no context.")
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ private[akka] object CassandraStorageBackend extends CommonStorageBackend {
|
||||||
override def getAll(owner: String, keys: Iterable[Array[Byte]]): Map[Array[Byte], Array[Byte]] = {
|
override def getAll(owner: String, keys: Iterable[Array[Byte]]): Map[Array[Byte], Array[Byte]] = {
|
||||||
sessions.withSession{
|
sessions.withSession{
|
||||||
session => {
|
session => {
|
||||||
var predicate = new SlicePredicate().setColumn_names(JavaConversions.asList(keys.toList))
|
var predicate = new SlicePredicate().setColumn_names(JavaConversions.asJavaList(keys.toList))
|
||||||
val cols = session / (owner, parent, predicate, CONSISTENCY_LEVEL)
|
val cols = session / (owner, parent, predicate, CONSISTENCY_LEVEL)
|
||||||
var map = new TreeMap[Array[Byte], Array[Byte]]()(ordering)
|
var map = new TreeMap[Array[Byte], Array[Byte]]()(ordering)
|
||||||
cols.foreach{
|
cols.foreach{
|
||||||
|
|
@ -124,10 +124,10 @@ private[akka] object CassandraStorageBackend extends CommonStorageBackend {
|
||||||
new KeyRange().setStart_key("").setEnd_key(""), CONSISTENCY_LEVEL)
|
new KeyRange().setStart_key("").setEnd_key(""), CONSISTENCY_LEVEL)
|
||||||
|
|
||||||
val mutations = new JHMap[String, JMap[String, JList[Mutation]]]
|
val mutations = new JHMap[String, JMap[String, JList[Mutation]]]
|
||||||
JavaConversions.asIterable(slices).foreach{
|
JavaConversions.asScalaIterable(slices).foreach{
|
||||||
keySlice: KeySlice => {
|
keySlice: KeySlice => {
|
||||||
val key = keySlice.getKey
|
val key = keySlice.getKey
|
||||||
val keyMutations = JavaConversions.asMap(mutations).getOrElse(key, {
|
val keyMutations = JavaConversions.asScalaMap(mutations).getOrElse(key, {
|
||||||
val km = new JHMap[String, JList[Mutation]]
|
val km = new JHMap[String, JList[Mutation]]
|
||||||
mutations.put(key, km)
|
mutations.put(key, km)
|
||||||
km
|
km
|
||||||
|
|
@ -135,7 +135,7 @@ private[akka] object CassandraStorageBackend extends CommonStorageBackend {
|
||||||
val amutation = new JAList[Mutation]
|
val amutation = new JAList[Mutation]
|
||||||
val cols = new JAList[Array[Byte]]
|
val cols = new JAList[Array[Byte]]
|
||||||
keyMutations.put(parent.getColumn_family, amutation)
|
keyMutations.put(parent.getColumn_family, amutation)
|
||||||
JavaConversions.asIterable(keySlice.getColumns) foreach {
|
JavaConversions.asScalaIterable(keySlice.getColumns) foreach {
|
||||||
cosc: ColumnOrSuperColumn => {
|
cosc: ColumnOrSuperColumn => {
|
||||||
cols.add(cosc.getColumn.getName)
|
cols.add(cosc.getColumn.getName)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,11 +63,11 @@ private[akka] object MemcachedStorageBackend extends CommonStorageBackend {
|
||||||
}
|
}
|
||||||
|
|
||||||
def getAll(keys: Iterable[Array[Byte]]) = {
|
def getAll(keys: Iterable[Array[Byte]]) = {
|
||||||
val jmap = client.getBulk(JavaConversions.asList(keys.map{
|
val jmap = client.getBulk(JavaConversions.asJavaList(keys.map{
|
||||||
k: Array[Byte] =>
|
k: Array[Byte] =>
|
||||||
keyStr(encodeKey(k))
|
keyStr(encodeKey(k))
|
||||||
}.toList))
|
}.toList))
|
||||||
JavaConversions.asMap(jmap).map{
|
JavaConversions.asScalaMap(jmap).map{
|
||||||
kv => kv match {
|
kv => kv match {
|
||||||
case (key, value) => (base64.decode(key) -> value.asInstanceOf[Array[Byte]])
|
case (key, value) => (base64.decode(key) -> value.asInstanceOf[Array[Byte]])
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ private[akka] object RiakStorageBackend extends CommonStorageBackend {
|
||||||
|
|
||||||
def drop() {
|
def drop() {
|
||||||
val keys = riakClient.listKeys(bucket)
|
val keys = riakClient.listKeys(bucket)
|
||||||
JavaConversions.asIterable(keys) foreach {
|
JavaConversions.asScalaIterable(keys) foreach {
|
||||||
delete(_)
|
delete(_)
|
||||||
}
|
}
|
||||||
keys.close
|
keys.close
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ private[akka] object SimpledbStorageBackend extends CommonStorageBackend {
|
||||||
var res = getClient.select(req)
|
var res = getClient.select(req)
|
||||||
var continue = true
|
var continue = true
|
||||||
do {
|
do {
|
||||||
JavaConversions.asIterable(res.getItems) foreach {
|
JavaConversions.asScalaIterable(res.getItems) foreach {
|
||||||
item => map += (base64key.decode(item.getName) -> recomposeValue(item.getAttributes).get)
|
item => map += (base64key.decode(item.getName) -> recomposeValue(item.getAttributes).get)
|
||||||
}
|
}
|
||||||
if (res.getNextToken ne null) {
|
if (res.getNextToken ne null) {
|
||||||
|
|
@ -272,7 +272,7 @@ private[akka] object SimpledbStorageBackend extends CommonStorageBackend {
|
||||||
}
|
}
|
||||||
|
|
||||||
def recomposeValue(atts: JList[Attribute]): Option[Array[Byte]] = {
|
def recomposeValue(atts: JList[Attribute]): Option[Array[Byte]] = {
|
||||||
val itemSnapshot = JavaConversions.asIterable(atts).foldLeft(new MMap[String, String]) {
|
val itemSnapshot = JavaConversions.asScalaIterable(atts).foldLeft(new MMap[String, String]) {
|
||||||
(map, att) => {
|
(map, att) => {
|
||||||
map += (att.getName -> att.getValue)
|
map += (att.getName -> att.getValue)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,8 +77,8 @@ private[akka] object VoldemortStorageBackend extends CommonStorageBackend {
|
||||||
}
|
}
|
||||||
|
|
||||||
def getAll(keys: Iterable[Array[Byte]]): Map[Array[Byte], Array[Byte]] = {
|
def getAll(keys: Iterable[Array[Byte]]): Map[Array[Byte], Array[Byte]] = {
|
||||||
val jmap = client.getAll(JavaConversions.asIterable(keys))
|
val jmap = client.getAll(JavaConversions.asJavaIterable(keys))
|
||||||
JavaConversions.asMap(jmap).map{
|
JavaConversions.asScalaMap(jmap).map{
|
||||||
kv =>
|
kv =>
|
||||||
kv match {
|
kv match {
|
||||||
case (key: Array[Byte], versioned: Versioned[Array[Byte]]) => (key -> versioned.getValue)
|
case (key: Array[Byte], versioned: Versioned[Array[Byte]]) => (key -> versioned.getValue)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ trait EmbeddedVoldemort extends BeforeAndAfterAll with Logging {
|
||||||
val home = new File(dir)
|
val home = new File(dir)
|
||||||
log.info("Creating Voldemort Config")
|
log.info("Creating Voldemort Config")
|
||||||
val config = VoldemortConfig.loadFromVoldemortHome(home.getCanonicalPath)
|
val config = VoldemortConfig.loadFromVoldemortHome(home.getCanonicalPath)
|
||||||
config.setStorageConfigurations(JavaConversions.asList(List(classOf[InMemoryStorageConfiguration].getName)))
|
config.setStorageConfigurations(JavaConversions.asJavaList(List(classOf[InMemoryStorageConfiguration].getName)))
|
||||||
log.info("Starting Voldemort")
|
log.info("Starting Voldemort")
|
||||||
server = new VoldemortServer(config)
|
server = new VoldemortServer(config)
|
||||||
server.start
|
server.start
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue