blob: d328d7bf23ce3bd80a7d3b63761ece4e663a46d5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
package thrift;
import javax.swing.JOptionPane;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;
import org.openslx.imagemaster.thrift.iface.ImageServer.Client;
public class MasterThriftConnection {
public static final String MASTERSERVERIP="132.230.4.16";
//public static final String MASTERSERVERIP="127.0.0.1";
final TTransport transport = new TSocket(MASTERSERVERIP, 9090);
public Client getMasterThriftConnection()
{
try {
transport.open();
} catch (TTransportException e) {
System.out.println("Keine Verbindung m\u00f6glich!");
JOptionPane.showMessageDialog(null,
e.getCause()+"\n"+e.getMessage(),
"Debug-Message", JOptionPane.ERROR_MESSAGE);
return null;
}
final TProtocol protocol = new TBinaryProtocol(transport);
final Client client = new Client(protocol);
System.out.println("Masterserver erreichbar.");
return client;
}
public void closeMasterThriftConnection()
{
transport.close();
}
}
|