<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,6 @@
 require 'xmlrpc/client'
 require 'pp'
+require 'thread'
 
 #
 # Ruby wrapper for Ubigraph.
@@ -7,31 +8,31 @@ require 'pp'
 # Call Rubigraph.init at first.
 #
 module Rubigraph
-  VERSION = '0.1.0'
+  VERSION = '0.2.0'
 
   class Vertex
     attr_reader :id
 
     def initialize(id = nil)
       @id = id ?
-        Rubigraph.server.call('ubigraph.new_vertex_w_id', id) :
-        Rubigraph.server.call('ubigraph.new_vertex')
+        Rubigraph.call('ubigraph.new_vertex_w_id', id) :
+        Rubigraph.call('ubigraph.new_vertex')
       raise 'Rubigraph::Vertex.initialize: cannot create vertex' if @id == -1
     end
 
     def remove
-      if -1 == Rubigraph.server.call('ubigraph.remove_vertex', @id)
+      if -1 == Rubigraph.call('ubigraph.remove_vertex', @id)
         raise &quot;Rubigraph::Vertex#remove: cannot remove vertex #{@id}&quot;
       end
     end
 
     def set_attribute(att, value)
-      Rubigraph.server.call('ubigraph.set_vertex_attribute', @id, att, value.to_s)
+      Rubigraph.call('ubigraph.set_vertex_attribute', @id, att, value.to_s)
     end
 
     def set_attributes(attrs)
       attrs.each do |k, v|
-        Rubigraph.server.call('ubigraph.set_vertex_attribute', @id, k, v.to_s)
+        Rubigraph.call('ubigraph.set_vertex_attribute', @id, k, v.to_s)
       end
     end
 
@@ -83,27 +84,25 @@ module Rubigraph
     # create an Edge.
     # from, to should be Vertex.
     def initialize(from, to, id = nil)
-      if id
-        @id = Rubigraph.server.call('ubigraph.new_edge_w_id', id, from.id, to.id)
-      else
-        @id = Rubigraph.server.call('ubigraph.new_edge', from.id, to.id)
-      end
+      @id = id ?
+        Rubigraph.call('ubigraph.new_edge_w_id', id, from.id, to.id) :
+        Rubigraph.call('ubigraph.new_edge', from.id, to.id)
       raise 'Rubigraph::Edge.initialize: cannot create edge' if @id == -1
     end
 
     def remove
-      if -1 == Rubigraph.server.call('ubigraph.remove_edge', @id)
+      if -1 == Rubigraph.call('ubigraph.remove_edge', @id)
         raise &quot;Rubigraph::Edge#remove: cannot remove edge #{@id}&quot;
       end
     end
 
     def set_attribute(att, value)
-      Rubigraph.server.call('ubigraph.set_edge_attribute', @id, att, value.to_s)
+      Rubigraph.call('ubigraph.set_edge_attribute', @id, att, value.to_s)
     end
 
     def set_attributes(attrs)
       attrs.each do |k, v|
-        Rubigraph.server.call('ubigraph.set_edge_attribute', @id, k, v.to_s)
+        Rubigraph.call('ubigraph.set_edge_attribute', @id, k, v.to_s)
       end
     end
 
@@ -163,15 +162,28 @@ module Rubigraph
   # initialize XML-RPC client
   def self.init(host='127.0.0.1', port='20738')
     @server = XMLRPC::Client.new2(&quot;http://#{host}:#{port}/RPC2&quot;)
+    @mutex  = Mutex.new
   end
 
   # clear all vertex, edges
   def self.clear
-    @server.call('ubigraph.clear')
+    call('ubigraph.clear')
   end
 
-  # for internal use.
-  def self.server
-    @server
+  def self.call(msg, *args)
+    @mutex.synchronize {
+      case args.size
+      when 0
+        @server.call(msg)
+      when 1
+        @server.call(msg, args[0])
+      when 2
+        @server.call(msg, args[0], args[1])
+      when 3
+        @server.call(msg, args[0], args[1], args[2])
+      else
+        raise
+      end
+    }
   end
 end # Rubigraph</diff>
      <filename>lib/rubigraph.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,12 @@
 Gem::Specification.new do |s|
   s.name = %q{rubigraph}
-  s.version = &quot;0.1.0&quot;
+  s.version = &quot;0.2.0&quot;
 
   s.specification_version = 2 if s.respond_to? :specification_version=
 
   s.required_rubygems_version = Gem::Requirement.new(&quot;&gt;= 0&quot;) if s.respond_to? :required_rubygems_version=
   s.authors = [&quot;mootoh&quot;]
-  s.date = %q{2008-05-29}
+  s.date = %q{2008-06-04}
   s.description = %q{a Ruby wrap for Ubigraph (http://www.ubietylab.net/ubigraph).  see http://www.ubietylab.net/ubigraph/content/Docs/index.html to get complete description about API.}
   s.email = %q{mootoh@gmail.com}
   s.extra_rdoc_files = [&quot;History.txt&quot;, &quot;Manifest.txt&quot;, &quot;README.txt&quot;]</diff>
      <filename>rubigraph.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -0,0 +1,37 @@
+require 'test/unit'
+require 'lib/rubigraph'
+
+Rubigraph.init
+
+class RubigraphTest &lt; Test::Unit::TestCase
+  def test_clear
+    Rubigraph.clear
+  end
+
+  def test_vertex
+    v = Rubigraph::Vertex.new
+    v.set_attribute('size', '2.0')
+    v.remove
+  end
+
+  def test_edge
+    v1 = Rubigraph::Vertex.new
+    v2 = Rubigraph::Vertex.new
+    e  = Rubigraph::Edge.new(v1, v2)
+    e.label = 'edge'
+    e.remove
+  end
+
+  def test_many
+    vs = []
+    100.times do |i|
+      v = Rubigraph::Vertex.new
+      v.color = sprintf(&quot;#%02d%02d%02d&quot;, i, i, i)
+      vs.push v
+    end
+
+    100.times do |i|
+      e = Rubigraph::Edge.new(vs[i], vs[(i+1)%100])
+    end
+  end
+end</diff>
      <filename>test/test_rubigraph.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>08362f72ae1ee44d25dc31fd11f2ad1c2fee438f</id>
    </parent>
  </parents>
  <author>
    <name>mootoh</name>
    <email>mootoh@gmail.com</email>
  </author>
  <url>http://github.com/mootoh/rubigraph/commit/962c495fa7b562568efdb06f4dd6d3b7830b7cf6</url>
  <id>962c495fa7b562568efdb06f4dd6d3b7830b7cf6</id>
  <committed-date>2008-06-03T10:31:40-07:00</committed-date>
  <authored-date>2008-06-03T10:31:40-07:00</authored-date>
  <message>0.2.0: serialized XMLRPC call.</message>
  <tree>5c041baec5a02fa52a25c5759530a2845ec0d1c7</tree>
  <committer>
    <name>mootoh</name>
    <email>mootoh@gmail.com</email>
  </committer>
</commit>
