Skip to content

Commit c8b0589

Browse files
authored
Merge pull request #209 from xuwei-k/procedure-syntax
fix procedure syntax
2 parents 6015fc4 + 2f243d8 commit c8b0589

File tree

8 files changed

+23
-23
lines changed

8 files changed

+23
-23
lines changed

src/main/scala/com/redis/PubSub.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package com.redis
22

33
object Util {
44
object Break extends RuntimeException
5-
def break { throw Break }
6-
def whileTrue(block: => Unit) {
5+
def break: Unit = { throw Break }
6+
def whileTrue(block: => Unit): Unit = {
77
while (true)
88
try {
99
block
@@ -23,12 +23,12 @@ trait PubSub extends PubOperations { self: Redis =>
2323

2424
class Consumer(fn: PubSubMessage => Any) extends Runnable {
2525

26-
def start () {
26+
def start (): Unit = {
2727
val myThread = new Thread(this) ;
2828
myThread.start() ;
2929
}
3030

31-
override def run() {
31+
override def run(): Unit = {
3232
try {
3333
whileTrue {
3434
asList match {
@@ -62,7 +62,7 @@ trait PubSub extends PubOperations { self: Redis =>
6262
}
6363
}
6464

65-
def pSubscribe(channel: String, channels: String*)(fn: PubSubMessage => Any) {
65+
def pSubscribe(channel: String, channels: String*)(fn: PubSubMessage => Any): Unit = {
6666
if (pubSub) { // already pubsub ing
6767
pSubscribeRaw(channel, channels: _*)
6868
return
@@ -72,7 +72,7 @@ trait PubSub extends PubOperations { self: Redis =>
7272
new Consumer(fn).start()
7373
}
7474

75-
def pSubscribeRaw(channel: String, channels: String*) {
75+
def pSubscribeRaw(channel: String, channels: String*): Unit = {
7676
send("PSUBSCRIBE", channel :: channels.toList)(())
7777
}
7878

@@ -83,7 +83,7 @@ trait PubSub extends PubOperations { self: Redis =>
8383
def pUnsubscribe(channel: String, channels: String*): Unit = {
8484
send("PUNSUBSCRIBE", channel :: channels.toList)(())
8585
}
86-
def subscribe(channel: String, channels: String*)(fn: PubSubMessage => Any) {
86+
def subscribe(channel: String, channels: String*)(fn: PubSubMessage => Any): Unit = {
8787
if (pubSub) { // already pubsub ing
8888
subscribeRaw(channel, channels: _*)
8989
} else {
@@ -93,7 +93,7 @@ trait PubSub extends PubOperations { self: Redis =>
9393
}
9494
}
9595

96-
def subscribeRaw(channel: String, channels: String*) {
96+
def subscribeRaw(channel: String, channels: String*): Unit = {
9797
send("SUBSCRIBE", channel :: channels.toList)(())
9898
}
9999

src/main/scala/com/redis/RedisClient.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ trait RedisCommand extends Redis with Operations
8888
}
8989
}
9090

91-
private def selectDatabase() {
91+
private def selectDatabase(): Unit = {
9292
if (database != 0)
9393
select(database)
9494
}
9595

96-
private def authenticate() {
96+
private def authenticate(): Unit = {
9797
secret.foreach(auth _)
9898
}
9999

src/main/scala/com/redis/cluster/HashRing.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ case class HashRing[T](nodes: List[T], replicas: Int) {
4141
/*
4242
* Removes node from the ring
4343
*/
44-
def removeNode(node: T) {
44+
def removeNode(node: T): Unit = {
4545
cluster -= node
4646
(1 to replicas).foreach {replica =>
4747
ring -= nodeHashFor(node, replica)

src/main/scala/com/redis/cluster/RedisCluster.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ abstract class RedisCluster(hosts: ClusterNode*) extends RedisCommand {
111111
}
112112

113113
//remove a server
114-
def removeServer(nodename: String){
114+
def removeServer(nodename: String): Unit ={
115115
hr.cluster.find(_.node.nodename.equals(nodename)) match {
116116
case Some(pool) => {
117117
hr removeNode(pool)

src/main/scala/com/redis/cluster/RedisShards.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ abstract class RedisShards(val hosts: List[ClusterNode]) extends RedisCommand {
4949
}
5050

5151
//remove a server
52-
def removeServer(nodename: String){
52+
def removeServer(nodename: String): Unit ={
5353
if (clients.contains(nodename)) {
5454
val pool = clients(nodename)
5555
pool.close

src/test/scala/com/redis/BlockingDequeSpec.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ class BlockingDequeSpec extends FunSpec
2121
val r2 = new RedisDequeClient("localhost", 6379).getDeque("btd", blocking = true, timeoutInSecs = 30)
2222

2323
class Foo extends Runnable {
24-
def start () {
24+
def start (): Unit = {
2525
val myThread = new Thread(this) ;
2626
myThread.start() ;
2727
}
2828

29-
def run {
29+
def run: Unit = {
3030
val v = r1.poll
3131
v.get should equal("foo")
3232
r1.clear
@@ -47,12 +47,12 @@ class BlockingDequeSpec extends FunSpec
4747
val r2 = new RedisDequeClient("localhost", 6379).getDeque("btd", blocking = true, timeoutInSecs = 30)
4848

4949
class Foo extends Runnable {
50-
def start () {
50+
def start (): Unit = {
5151
val myThread = new Thread(this) ;
5252
myThread.start() ;
5353
}
5454

55-
def run {
55+
def run: Unit = {
5656
val v = r1.pollLast
5757
v.get should equal("foo")
5858
r1.clear

src/test/scala/com/redis/ListOperationsSpec.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,12 @@ class ListOperationsSpec extends FunSpec
354354
it("should pop blockingly") {
355355
val r1 = new RedisClient("localhost", 6379)
356356
class Foo extends Runnable {
357-
def start () {
357+
def start (): Unit = {
358358
val myThread = new Thread(this) ;
359359
myThread.start() ;
360360
}
361361

362-
def run {
362+
def run: Unit = {
363363
r.brpoplpush("l1", "l2", 3) should equal(Some("a"))
364364
r1.disconnect
365365
r.lpop("l2") should equal(Some("a"))
@@ -383,12 +383,12 @@ class ListOperationsSpec extends FunSpec
383383
it ("should pop in a blocking mode") {
384384
val r1 = new RedisClient("localhost", 6379)
385385
class Foo extends Runnable {
386-
def start () {
386+
def start (): Unit = {
387387
val myThread = new Thread(this) ;
388388
myThread.start() ;
389389
}
390390

391-
def run {
391+
def run: Unit = {
392392
r.blpop(3, "l1", "l2") should equal(Some("l1", "a"))
393393
r1.disconnect
394394
}

src/test/scala/com/redis/WatchSpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class WatchSpec extends FunSpec
3232
it("should fail a transaction if modified from another client") {
3333
implicit val clients = new RedisClientPool("localhost", 6379)
3434
class P1 extends Runnable {
35-
def run() {
35+
def run(): Unit = {
3636
clients.withClient { client =>
3737
client.watch("key")
3838
client.pipeline { p =>
@@ -45,7 +45,7 @@ class WatchSpec extends FunSpec
4545
}
4646
}
4747
class P2 extends Runnable {
48-
def run() {
48+
def run(): Unit = {
4949
clients.withClient { client =>
5050
Thread.sleep(10)
5151
client.set("key", "anshin")

0 commit comments

Comments
 (0)