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 PongActor extends Actor { | |
def act() { | |
val y = 4 | |
loop { | |
react { | |
case Ping(2) => | |
println("got ping(2)") | |
sender ! Pong | |
case Ping(y) => | |
println("got ping(y)") |
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
a !? (2000, WantNext("group", "test")) match { | |
case m1: Some[NextMessage] => | |
println("case Some[NextMessage]") | |
println(m1) | |
case m1: Some[NoMessage] => | |
println("case Some[NoMessage]") | |
println(m1) | |
case m1: Option[Nothing] => | |
println("case Option[Nothin]") | |
println(m1) |
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
public class SolrUpdater implements Runnable { | |
private final SolrInputDocument doc = new SolrInputDocument(); | |
private final UpdateRequest req = new UpdateRequest(); | |
private final SolrServer solr; | |
private final BlockingQueue<String> strings; | |
private final AtomicLong id; | |
public SolrUpdater(SolrServer solr, BlockingQueue<String> strings, | |
AtomicLong id) { | |
this.solr = solr; |
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
public static class SolrUpdater implements Runnable { | |
private final UpdateRequest req = new UpdateRequest(); | |
private final SolrServer solr; | |
private final BlockingQueue<String> strings; | |
private final AtomicLong id; | |
private final int batchSize = 100; | |
private volatile int batchedUpdates = 0; | |
public SolrUpdater(SolrServer solr, BlockingQueue<String> strings, | |
AtomicLong id) { |
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
<fields> | |
<field name="id" type="string" indexed="true" stored="true" required="true"/> | |
<field name="_version_" type="long" indexed="true" stored="true"/> | |
<!-- DocValue fields --> | |
<field name="threadId_dv" type="string" indexed="false" stored="false" docValues="true" default=""/> | |
<field name="docId_dv" type="tint" indexed="false" stored="false" docValues="true" default="0"/> | |
<field name="wordId_dv" type="tint" indexed="false" stored="false" docValues="true" default="0"/> | |
<field name="word_dv" type="string" indexed="false" stored="false" docValues="true" default=""/> | |
<field name="count_dv" type="tint" indexed="false" stored="false" docValues="true" default="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
import java.util.concurrent.atomic.AtomicLong; | |
import java.util.concurrent.BlockingQueue; | |
import java.util.concurrent.LinkedBlockingQueue; | |
import java.util.concurrent.TimeUnit; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.ExecutorService; | |
import java.io.BufferedReader; | |
import java.io.FileReader; | |
import java.io.File; | |
import java.io.IOException; |
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
length, 29: 00 00 00 1d | |
api key: 00 07 | |
api version: 00 00 | |
correlation 42: 00 00 00 2a | |
clientId "foo": 00 03 66 6f 6f | |
group "test-group": 00 0a 74 65 73 74 2d 67 72 6f 75 70 | |
array length: 00 00 00 00 |
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
from threading import Thread, Event | |
from Queue import Queue | |
class Proc(Thread): | |
def __init__(self, in_queue): | |
Thread.__init__(self) | |
self.in_queue = in_queue | |
self.die = Event() | |
def stop(self): |
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
import java.io.IOException; | |
import java.util.Map; | |
import org.apache.pig.EvalFunc; | |
import org.apache.pig.data.DataType; | |
import org.apache.pig.data.Tuple; | |
/** | |
* Simple UDF to allow modifying an existing map[] datum | |
* | |
* Usage: |
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
/*Pig script to convert the user,movie,rating,timestamp data to a user-user graph for running adsorption algorithm. | |
The format of the input data is | |
1::122::5::838985046 | |
*/ | |
/*Loading the data into a table. The delimiter might be different for different inputs. */ |