KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > cache > perf > aop > Server


1 /*
2  *
3  * JBoss, the OpenSource J2EE webOS
4  *
5  * Distributable under LGPL license.
6  * See terms of license at gnu.org.
7  */

8
9 package org.jboss.test.cache.perf.aop;
10
11
12 import org.jboss.cache.PropertyConfigurator;
13 import org.jboss.cache.aop.TreeCacheAop;
14
15 import java.io.InputStreamReader JavaDoc;
16
17 /**
18  * A standalone dummy server that accepts data from other replicated cache.
19  */

20 public class Server
21 {
22    TreeCacheAop cache_;
23
24    void initCach() throws Exception JavaDoc
25    {
26       cache_ = new TreeCacheAop();
27       PropertyConfigurator config = new PropertyConfigurator();
28       config.configure(cache_, "META-INF/replSync-service.xml"); // read in generic replAsync xml
29
cache_.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
30       cache_.startService();
31    }
32
33    void destroyCache() throws Exception JavaDoc
34    {
35       cache_.stopService();
36       cache_ = null;
37    }
38
39    TreeCacheAop getCache()
40    {
41       return cache_;
42    }
43
44    public static void main(String JavaDoc[] args) throws Exception JavaDoc
45    {
46       Server server = new Server();
47       server.initCach();
48       boolean isYes = true;
49       InputStreamReader JavaDoc reader = new InputStreamReader JavaDoc(System.in);
50       while (isYes) {
51          System.out.println("To abort hit cntrl-c");
52 // System.out.println(server.getCache().printLockInfo());
53
try {
54             Thread.sleep(10000);
55          } catch (Exception JavaDoc ex) {
56          }
57          ;
58       }
59       server.destroyCache();
60    }
61 }
62
Popular Tags