So a common counter to "the VM startup time is so bad" problem is to use
Nailgun for a long-running server process. I've gotten this working in
some respects, but I get a "Unexpected chunk type 83 ('S')" error quite
often when I'm trying to read from the stdin that the nailgun context
provides.
(ns nailgun.example
(:use [clojure.contrib.duck-streams])
(:import [com.martiansoftware.nailgun NGServer NGContext]
[java.io BufferedReader InputStreamReader
OutputStreamWriter PrintWriter])
(:gen-class))
(gen-class :name nailgun.Example
:prefix "Example-"
:methods [#^{:static true}
[nailMain [com.martiansoftware.nailgun.NGContext] void]]
:main false)
(defn Example-nailMain
[#^NGContext context]
(let [out (writer (-> context .out))]
(copy (-> context .in) out)
(.flush out)))
(defn -main []
(.start (Thread. (NGServer.))))
I compile this, and then run the nailgun.example class. Then I try to
connect via the ng client:
p...@dynabook ~ $ echo "hello" | ng nailgun.Example
Unexpected chunk type 83 ('S')
bash: echo: write error: Broken pipe
p...@dynabook ~ $ echo "hello" | ng nailgun.Example
p...@dynabook ~ $ echo "hello" | ng nailgun.Example
p...@dynabook ~ $ echo "hello" | ng nailgun.Example
Unexpected chunk type 83 ('S')
bash: echo: write error: Broken pipe
p...@dynabook ~ $ echo "hello" | ng nailgun.Example
p...@dynabook ~ $ echo "hello" | ng nailgun.Example
Unexpected chunk type 83 ('S')
I've taken a look at the "nails.clj" file in vimclojure since I know
that it uses nailgun. The only difference seems to be that it wraps the
context's input stream in a LineNumberingPushbackReader as well as an
InputStreamReader, but that doesn't seem to make a difference.
Any ideas what I'm doing wrong? How is this supposed to be used?
thanks,
Phil
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---