~ubuntu-branches/ubuntu/wily/libjboss-remoting-java/wily

« back to all changes in this revision

Viewing changes to src/main/org/jboss/remoting/samples/transporter/multiple/server/Server.java

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2011-09-09 14:01:03 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: package-import@ubuntu.com-20110909140103-hqokx61534tas9rg
Tags: 2.5.3.SP1-1
* Newer but not newest upstream release. Do not build samples.
* Change debian/watch to upstream's svn repo.
* Add patch to fix compile error caused by tomcat update.
  (Closes: #628303)
* Switch to source format 3.0.
* Switch to debhelper level 7.
* Remove useless Depends.
* Update Standards-Version: 3.9.2.
* Update README.source.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.jboss.remoting.samples.transporter.multiple.server;
 
2
 
 
3
import org.jboss.remoting.samples.transporter.multiple.CustomerProcessorImpl;
 
4
import org.jboss.remoting.samples.transporter.multiple.AccountProcessorImpl;
 
5
import org.jboss.remoting.samples.transporter.multiple.CustomerProcessor;
 
6
import org.jboss.remoting.samples.transporter.multiple.AccountProcessor;
 
7
import org.jboss.remoting.transporter.TransporterServer;
 
8
 
 
9
 
 
10
/**
 
11
 * @author <a href="mailto:tom.elrod@jboss.com">Tom Elrod</a>
 
12
 */
 
13
public class Server
 
14
{
 
15
   private String locatorURI = "socket://localhost:5400";
 
16
   private TransporterServer server = null;
 
17
 
 
18
   public void start() throws Exception
 
19
   {
 
20
      server = TransporterServer.createTransporterServer(locatorURI, new CustomerProcessorImpl(), CustomerProcessor.class.getName());
 
21
      server.addHandler(new AccountProcessorImpl(), AccountProcessor.class.getName());
 
22
   }
 
23
 
 
24
   public void stop()
 
25
   {
 
26
      if(server != null)
 
27
      {
 
28
         server.stop();
 
29
      }
 
30
   }
 
31
 
 
32
   public static void main(String[] args)
 
33
   {
 
34
      Server server = new Server();
 
35
      try
 
36
      {
 
37
         server.start();
 
38
 
 
39
         Thread.currentThread().sleep(60000);
 
40
 
 
41
      }
 
42
      catch(Exception e)
 
43
      {
 
44
         e.printStackTrace();
 
45
      }
 
46
      finally
 
47
      {
 
48
         server.stop();
 
49
      }
 
50
   }
 
51
}