Testsv.java

Madars, 07/23/2020 02:39 PM

Download (1.21 KB)

 
1
import org.endurox.*;
2
import org.endurox.exceptions.*;
3
import java.util.*;
4

    
5
public class Testsv extends Thread implements Server, Service {
6

    
7
    
8
public void run(){
9
      System.out.println("Thread Running");
10
        AtmiCtx c2 = new AtmiCtx();
11
try
12
{
13
        c2.tpcall("YOPT", null, 0);
14
}
15
catch (Exception e)
16
{
17
}
18
    }
19

    
20
    public void tpService(AtmiCtx ctx, TpSvcInfo svcinfo) {
21

    
22
        ctx.tplogDebug("tpService/TESTSV called");
23

    
24
        //Reply OK back
25
        ctx.tpreturn(AtmiConst.TPSUCCESS, 0, svcinfo.getData(), 0);
26
    }
27

    
28
    public int tpSvrInit(AtmiCtx ctx, String [] argv) {
29
        ctx.tplogDebug("Into tpSvrInit()");
30

    
31
try
32
{
33
        ctx.tpcall("YOPT", null, 0);
34
}
35
catch (Exception e)
36
{
37
}
38

    
39

    
40
        ctx.tpadvertise("TESTSV", "Testsv", this);
41

    
42
        return AtmiConst.SUCCEED;
43
    }
44
    
45
    public void tpSvrDone(AtmiCtx ctx) {
46
        ctx.tplogDebug("Into tpSvrDone()");
47
    }
48

    
49
    public static void main(String[] args) {
50

    
51
        
52
  Testsv myThread = new Testsv();
53
  myThread.start();
54

    
55
try
56
{
57
Thread.sleep(2000);
58
}
59
catch (Exception e)
60
{
61
}
62
        AtmiCtx ctx = new AtmiCtx();
63
        ctx.tpinit(null);
64
        Testsv server = new Testsv();
65
        ctx.tprun(server, new String[] {"-k", "0myWI5nu", "-i", "1660", "-e", "/tmp/tmqueue-dom1.log"});
66
    }
67
}